How can what type a control in dialog is?
Anyone have an idea as to how to loop through all controls in a dialog and determining what type (i.e. button, list, combo etc.) they are? My task is to identify all buttons in various dialogs in a generic manner. I was hoping there was an MFC-call that can be used to get hold of a handle or something for controls within a dialog, and subsequently use that to determine its type. Have looked around, but haven't found anything "easy". Maybe there aren't anything easy for this?
Re: How can what type a control in dialog is?
Quote:
Originally Posted by DP TWO
My task is to identify all buttons in various dialogs in a generic manner...
What is a "button"? I can make a checkbox look like a button, or program static control to behave like one...
If you are interested in a Windows Common Control "BUTTON", you could use GetClassName() and compare that name to a "BUTTON".
Re: How can what type a control in dialog is?
For enumerating the controls in a dialog template, check this article
Enumerating Controls of a Dialog Resource at Runtime
Re: How can what type a control in dialog is?
Thanks to both. The article is very helpful. Should be able to do what I need based on that.
I apologize for the "sloppy" specifications of what I was looking for. Also for the very bad title of my posting. Didn't do a Post preview before posting due to being in a hurry...
Specifically what I need to find is any control based on the CButton class in any given dialog, being it a radio button, check box or "standard" button. Why? Because I need to turn off the "theme" stuff introduced in WinXP in order to control how the buttons are drawn in response to WM_SYSCOLORCHANGE.
Specifically I need the COLOR_BTNFACE to be black and COLOR_BTNTEXT to be red in some cases (for night time use) for all apps. running. But, since I really like the new look introduced in WinXP (which is why I don't just take the easy way out and change to "Windows Classic style" through control panel), I want to keep all my CButtons with the XP theme style in most cases (day time use). Therefore I need to determine how to call SetWindowTheme() for some controls in my dialogs (could be others that have "changed" drawing methods in XP as well, but I'lll deal with them as I come across them).
Thanks again for all the help. Once again Codeguru proves to be the place to go to come in contact with "the best of the best". Rating will be excellent of course...