I use ShellExecute to create a new app instance from my current app. I want to get the HWND of that app. Is it possible to get HWND from HINSTANCE or I need to use EnumWindows?
HWND is a "handle to a window" and is part of the Win32 API . HWNDs are essentially pointers (IntPtr) with values that make them (sort of) point to a window-structure data. In general HWNDs are part an example for applying the ADT model. If you want a Control's HWND see Control. Handle property.
hInstance is something called a "handle to an instance" or "handle to a module." The operating system uses this value to identify the executable (EXE) when it is loaded in memory. The instance handle is needed for certain Windows functions—for example, to load icons or bitmaps.
you're right, you need to enum your windows
this question will help you further
An application does not have a single HWND
. Each window within the app has its own handle, an HWND
.
You will need to use EnumWindows()
or one of its friends.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With