Skip to main content
GameDev.net gamedev.net
🔒 Locked

InitCommonControls question (Win32)

Started by CrazyCdn Oct 24, 2005 at 10:58 PM 2 replies 3.3k views
Original Post
CrazyCdn
CrazyCdn
Hi! As I just recently started working with the Windows API (no MFC etc) I have a question right off the bat, I likely answered it myself but just trying to stay sane and have everything work. I'm basically making up a program that will attempt to do everything I need in it, status bar, tool bar + tips, menu, progress bar, dialog boxes, etc, etc... I was wondering, with InitCommonControlsEx() do I need to declare all the ICC_whatever listed here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/common/structures/initcommoncontrolsex.asp I'm just wondering because I only use ICC_BAR_CLASSES so far as I only have those up and running. But I want a progress bar next so will I need ICC_PROGRESS_CLASS or can it work without it? Should I just or out everything I think I'll need in the future just to save time looking it up later or scratching my head? Is there a downfall for including too many? Thanks! Mike
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin
Metro_Mystery
Metro_Mystery
The ICC_values are used in InitCommonControlsEx() for common control class registration. As you're new to Windows programming- I'll explain this in a little more depth.

Registration is a process which involves assigning to a window/dialog many attributes they need in order for them to function properly. For example, when you define such a window (or dialog)- it needs to be told what function should be responsibile for handling and processes all of its window messages (this function is called WNDPROC function btw) etc. When programming in the windows API- you have to do a lot of this yourself however, most registration activity is done automatically in MFC.

Knowing this, it's best to tell comctl32.dll to register only those classes you're actually going to use in your program (it'll save a fair bit of window initialisation and assignment). If you're only learning though- it doesn't really make THAT much difference...
CrazyCdn
CrazyCdn
Thanks. I used everyone I thought I'd need as this is just a learning project, but on my main project I'll just add them as I need them. Looks like I can just call InitCommonControlsEx() in whatever section of code needs the new functionality as it seems to be comulative.

I know MFC would technically be easier but I'm a control freak. I have a friend who's busy working/studying otherwise I could pick his brain on a lot of this but he says youc an do anyting in Win32 that you can do in MFC, it's just "easier". I don't want to start some Win32 <> MFC debate, I'm just a low level guy I guess :)

Thanks for your help Metro_Mystery, you did answer my question completely.
"Those who would give up essential liberty to purchase a little temporary safety deserve neither liberty nor safety." --Benjamin Franklin
ChaoticCanuck
ChaoticCanuck
You can significantly ease the pain of handling messages and such by using the message cracker macros.

I suggest taking a look at them. They are part of the windowsx.h headers, and an example can be found here

There are tons of macros in there, but most of them are dedicated to hiding what's really happening, and making code readable. I just prefer message crackers because they stop the WindowProc from becoming a dogs breakfast.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.