Like the topic, how do I get HWND and HINSTANCE of the main form?

I need to use some native Windows API which requires HWND and HINSTANCE of the main form...

Like the topic, how do I get HWND and HINSTANCE of the main form? I need to use some native Windows API which requires HWND and HINSTANCE of the main form...

To get the native window handle of a form, call form::native_handle. For example:

HWND hwnd = reinterpret_cast<HWND>(fm.native_handle());

To get the module instance handle, call GetModuleHandle:

// can pass NULL if the build produces an .exe image file
HINSTANCE hinst = GetModuleHandleA(NULL);
To get the native window handle of a form, call `form::native_handle`. For example: ```` HWND hwnd = reinterpret_cast<HWND>(fm.native_handle()); ```` To get the module instance handle, call `GetModuleHandle`: ```` // can pass NULL if the build produces an .exe image file HINSTANCE hinst = GetModuleHandleA(NULL); ````

Thanks... the form::native_handle works beautifully...

Thanks... the form::native_handle works beautifully...
17
views
2
replies
2
followers
live preview
enter atleast 10 characters
WARNING: You mentioned %MENTIONS%, but they cannot see this message and will not be notified
Saving...
Saved
All posts under this topic will be deleted ?
Pending draft ... Click to resume editing
Discard draft