QuoteOnControl(int nID, int nNotifyCode, unsigned int hControl)
Hi everyone.
I can see what nID does but what about the other parameters?
Also, what is the difference between OnCreate() and a constructor?
Cheers
nNotifyCode is the message that the control generated such as BN_Clicked [0x0000] when the control is clicked with the mouse. hControl is the handle to the control.
The constructor is called when the class is instantiated (an "instance" of the class is made), while OnCreate is called when the window(dialog, control, etc.) is created. When the constructor is called the window does not yet exist. Probably someone can give a better answer than this ;)
Your second answer makes perfect sense Bruce.
So nNotifyCode is the event id? I am still unsure about hControl because the switch is testing nId, so I thought it would be the control handle. The switch seems to ask which control fired an event and nNotifyCode tests the type of event. I'm still not 100% sure of this.
nID is not a handle, it is the id you assign to the control when you create it.
myDlg.AddControl(int type, string title, int l, int t, int w, int h, int style, int exstyle, int ID)
// ID is the control's id number
hControl is the handle.
const CMD_OK = 1;
const CMD_CANCEL = 2;
...
ItemDialog::OnControl(int nID, int nNotifyCode, unsigned int hControl),int
{
select nID
{
case CMD_OK:
// process OK button here
case CMD_CANCEL:
CloseDialog(IDCANCEL);
}
return 0;
}
Bruce,
do you have or can you tell me where I can get a listing of all of these messages and how to apply them?
John,
I'm not sure I understand the question. I use
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/wincontrols.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/commctls/wincontrols.asp)
to get information about controls and their messages. I also rely heavily on the examples that come with the compiler and help from the Forum. I have a list of Windows constants that is in a text file (the source is long forgotten) that I could post, if that would be helpful.
Quote from: peaslee on March 07, 2007, 10:42:14 AM
...I have a list of Windows constants that is in a text file (the source is long forgotten) that I could post, if that would be helpful.
That list would be great! I have gone to MSDN & I just found an old book that I lost. I'm not as experienced at API stuff (control messages, etc.) as some of you other guys. I like to have off-line resources to look and study.
Here it is. There might be better ones out there, but this is fairly useful.
Ah, I now understand. Cheers Bruce.
looks like your constants list is popular. thanks Bruce
Quote from: John S on March 16, 2007, 10:50:48 AM
looks like your constants list is popular. thanks Bruce
You're welcome. I wish I could remember who sent it to me to provide proper credit.