Getting the HINSTANCE from HWND

3.4k Views Asked by At

GetWindowLong (GetTopWindow(NULL),GWL_HINSTANCE) returns 0 ... (Also tried with GetWindowLongPtr) Does anyone have an idea why is that?

Also how do you convert LONG to HINSTANCE?

  • GetTopWindow(NULL) does not return null

EDIT: The check is for a keylogger that is injected inside the application I want to log from. Using GetModuleHandle(0) I get the HINSTANCE of my injected app and if I could have the top window's HINSTANCE I could check to see if the input I get is for my application or not.

0

There are 0 best solutions below