• Advertisement
Sign in to follow this  

Get parent window of an application

This topic is 917 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

Hi guys,

Is it possible to retrieve the parent window of a application without knowing the window handle?

The reason I want to do this, is to get the HWND of the parent window to use in a function, without passing it via function parameter and not setting HWND to a global.

Hoping there is something like GetModuleHandle(NULL), which retrieves the HINSTANCE without having to pass around the HINSTANCE from the main function - if you get my drift.

Thanks in advance smile.png

Share this post


Link to post
Share on other sites
Advertisement

A win32 application can have as many top level windows as it wants, there's no requirement for there to be a 'parent' window.  The best you could maybe do is enumerate all top level windows (perhaps something in here might be of help: https://social.msdn.microsoft.com/Forums/en-US/c19a695d-a7d1-42b7-851e-12e98f427b39/can-i-get-all-the-windows-a-process-has?forum=vcgeneral) and filter them by some criteria.

Share this post


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

  • Advertisement