Common Controls and the InitCommonControls Functions

I'm a bit confused at the moment about the usage of the InitCommonControls() and InitCommonControlsEx() functions.

I thought a program had to call one of the InitCommonControls functions whenever the program used a common control. I believe this is a list of the common controls from the MSDN documentation:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb773169%28v=vs.85%29.aspx


However, it doesn't seem the edit control requires a call of either InitCommonControls functions and I didn't even need to link the comctl32.lib library or add in the header <commctrl.h> for the program to compile and run correctly.

It looks like I have to call one of the InitCommonControls() functions when I use a toolbar or status bar but not the edit control.


So a question... How can I tell when I need to call one of the InitCommonControls functions? There is probably something I'm missing in the MSDN documentation. Do you just have to learn by trial and error when you need to call one of the InitCommonControls functions?

Also, would it be acceptable to just call one of the InitCommonControls functions if I'm uncertain if it's required... ie could calling it affect a program in unexpected negative ways by just calling the function unnecessarily.

Thanks for any insight in helping me understand this.
Last edited on
What little documentation I can find says that Edit is indeed a common control. So someone else must have already called InitCommonControls(), or there would be no way for the CreateWindowEx() call could succeed.
Thanks for looking into this.

I tried copying my code to a new project to make sure it wasn't just some settings that were not showing up properly and the code wouldn't compile without making the appropriate links and headers so I'm thinking it must be something wrong with the way my IDE was reading the old program I had saved.
So a question... How can I tell when I need to call one of the InitCommonControls functions?


Probably if you use any of the controls listed on this page:

http://msdn.microsoft.com/en-us/library/windows/desktop/bb775507%28v=vs.85%29.aspx

Edit: That page mentions the standard controls, like edit and button, are part of user32 so that might explain why comctl32 wasn't needed.
Last edited on
Topic archived. No new replies allowed.