?
Solved

Dialog tabbed control won't show

Posted on 2000-03-22
5
Medium Priority
?
229 Views
Last Modified: 2010-04-10
I have a win32 api dialog program (no MFC).  When i try to add a tabbed control from the toolbar onto the dialog using the resource editor and compile it, it gives me 0 warnings and 0 errors.  Yet the form doesn't show.  What can i do?  When i delete the tabbed control the form shows.
0
Comment
Question by:Markenstein
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 

Expert Comment

by:tkirby052098
ID: 2647545
Assuming that the "visible" box is checked in the tab control resource properties, then the most likely causes are...

1) you have not initialized the common controls dll properly

INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_TAB_CLASSES;
InitCommonControlsEx(&icex);

2) you have not inserted any tabs into the control. without this step you are trying to display an empty control, so you see nothing. use TabCtrl_InsertItem and/or TabCtrl_SetItem as needed to add tabs to the control.

does this help?
0
 

Author Comment

by:Markenstein
ID: 2651311
I get the following errors after i added the commctrl.h.

INITCOMMONCONTROLSEX icex;
icex.dwSize = sizeof(icex);
icex.dwICC = ICC_TAB;
InitCommonControlsEx(&icex);

Main.obj : error LNK2001: unresolved external symbol __imp__InitCommonControlsEx@4
Debug/DlgApp.exe : fatal error LNK1120: 1 unresolved externals
0
 

Expert Comment

by:tkirby052098
ID: 2654672
Okay, you must be running an old version of the SDK (the extended function is not supported in your common controls .lib and .dll files).  Try
InitCommonControls(); instead (no arguments).  This should work every time.  What compiler and SDK are you using?
0
 

Author Comment

by:Markenstein
ID: 2655444
I'm using VC++ 6, i don't know what SDK i'm using...  How can i upgrade it?
0
 

Accepted Solution

by:
tkirby052098 earned 200 total points
ID: 2656011
The SDK that comes with vc6 should have the function we are looking for.  Did you include the comctl32.lib file in your link?  I use vc5, so you would add the file under Project->settings->Link tab->object/library modules. It is not included by default.
SDK upgrades...I think you can still download the Platform SDK from microsoft for free (it's huge and takes forever) or they will send you a CD for about $20. I got mine for free along with the 2000 beta. I'm not sure that you need this. Consult your vc6 docs to see which sdk you have.

No offense intended, but you sound like a novice, so I offer an explanation of what is happening:  In order for your tab control to display, your program must register the tab control class. This happens when you call the Init function and calling the function causes the dll to be loaded into your programs process memory. VC finds the code for the function during the link process by searching the lib files for the name of the function. So....if you don't tell vc the right lib files to search, it can't find the function, and the error happens. Before (when you were not calling the Init function), the dialog tried to display a window based on the tab control class, but that class was not registered, so nothing was displayed. QED.

Good luck!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In days of old, returning something by value from a function in C++ was necessarily avoided because it would, invariably, involve one or even two copies of the object being created and potentially costly calls to a copy-constructor and destructor. A…
Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
The viewer will learn how to pass data into a function in C++. This is one step further in using functions. Instead of only printing text onto the console, the function will be able to perform calculations with argumentents given by the user.
The viewer will learn how to clear a vector as well as how to detect empty vectors in C++.
Suggested Courses

765 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question