Jump to content
  • Advertisement
Sign in to follow this  

getting a window handle

This topic is 4816 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
Advertisement
If you know the windows title you could use FindWindow like so:

HWND hwnd = FindWindow(NULL,"YourWindowTitle");

Share this post


Link to post
Share on other sites
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);

Share this post


Link to post
Share on other sites
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 :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!