For example, let's say i want to get the HWND of the window that IDC_MYEDITCONTROL is located, how would i go about doing that?
Thanks.
For example, let's say i want to get the HWND of the window that IDC_MYEDITCONTROL is located, how would i go about doing that?
Thanks.
Not yet, have to think of one...
If you know the ID and the parent window handle of the child, you can get its window handle like so:
...or, do you mean you want to find the parent window handle of the child window?Code:hwndChild = GetDlgItem (hwndParent, idChild);
Last edited by JasonD; 08-07-2003 at 05:42 PM.
Yup, that's what i'm looking for, with just the resource ID. Something like:Originally posted by JasonD
...or, do you mean you want to find the parent window handle of the child window?
Code:HWND parentHwnd = GetParentHWND(IDC_EDITCONTROL);
Not yet, have to think of one...
Try GetWindowLong() using GWL_HWNDPARENT, you'll still need the handle of the control though, see Jason's post.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
To get the handle of the control, you need the handle of the parent. Heh. So, I guess you are going to have to store one or the other.
Jason:
If he knows the title of the parent window, he could use FindWindow(NULL, Title); to get it's handle. I guess like you, I'm a little mystified as to why he hasn't got/had this info. anyway.
Wave upon wave of demented avengers march cheerfully out of obscurity unto the dream.
that's strange. GetParent() requires the hwnd. You can't just use a control ID to get a parent.
"You are stupid! You are stupid! Oh, and don't forget, you are STUPID!" - Dexter
I would assume that is because there can be more than one control with the same id (each for different windows, of course).