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.
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);
Yup, that's what i'm looking for, with just the resource ID. Something like:Quote:
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);
Try GetWindowLong() using GWL_HWNDPARENT, you'll still need the handle of the control though, see Jason's post.
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.
that's strange. GetParent() requires the hwnd. You can't just use a control ID to get a parent.
I would assume that is because there can be more than one control with the same id (each for different windows, of course).