getting a window handle

Started by
2 comments, last by toxy 19 years, 1 month ago
I'm trying to retrieve a specific window handle and I'm not sure how to go about it in regular win32 programming. First I have to get a parent window of a dialog I create by using ::GetParent(hdlg) where hdlg is my dialog. Next I need to get a child of that window with an ID of lst2, but I'm not sure how to do that. Maybe a cleaner way to describe it is as it was shown in MFC: GetParent()->GetDlgItem(lst2); My problem is that I'm not using MFC. Can anyone help?
Advertisement
If you know the windows title you could use FindWindow like so:

HWND hwnd = FindWindow(NULL,"YourWindowTitle");
I think you can translate that directly. You can always check out MFC sources, they're often no more than WIN32 wrappers.
Try this:
GetDlgItem(GetParent(hdlg), lst2);
Wow, I am a true fool. I don't know how I missed GetDlgItem - it can't get much more straitforward than that!

Thanx for you help :)

This topic is closed to new replies.

Advertisement