-
July 20th, 2005, 02:44 PM
#1
Get Dialog Box ID
I am trying to get the ID of a dialog box inside the callback function. I figured the following should work:
Upon entry to the dialog callback function:
dlgidd = GetWindowLong(hwindow, GWL_ID); // Get the dialog ID number
if(dlgidd == 0)
{
radioID = GetLastError();
}
But I get the error "Invalid window handle". It happens even if I put it after the WM_INITDIALOG message. I have no problem setting a value (the 'hwindow' value seems okay for the SetWindowLong() function).
Any ideas? I must be doing something VERY stupid!!
I am passing different dialog box templates and I thought this would be a good way to get the ID without placing it as a parameter.
Thanks,
Brian
-
July 20th, 2005, 05:14 PM
#2
Re: Get Dialog Box ID
Toplevel windows cannot have an ID. A resource ID for dialogs is only used to identify the dialog inside the resource section of an application.
Originally Posted by MSDN
Although GetDlgCtrlID may return a value if hwndCtl is a handle to a top-level window, top-level windows cannot have identifiers and such a return value is never valid.
- Check GetDlgCtrlID on MSDN.
- And please use Code Tags next time you post code!
-
July 21st, 2005, 05:41 AM
#3
Re: Get Dialog Box ID
RATS! Not what I wanted to hear. Thanks for the info, though!
Brian
-
July 24th, 2005, 07:36 PM
#4
Re: Get Dialog Box ID
I think the judgement sentence "dlgidd == 0" is incorrect. The dialog box ID could be 0, like the id of the menu. If you wanna get the handle of the dialog box, you should use the function GetDlgItem();
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|