//window is an HWND
LPWSTR path = new WCHAR[1024];
DWORD size = 1024;
GetWindowText(window, path, 1024);
HINSTANCE instance = (HINSTANCE)GetWindowLongPtr(window, GWLP_HINSTANCE);
QueryFullProcessImageName(instance, PROCESS_NAME_NATIVE, path, &size);
This code fails on the call to QueryFullProcessImageName(...) with an error code 6 [invalid handle]. GetWindowText succeeds, and GetWindowLong returns a non-zero HINSTANCE.
I'm pretty new to win32, so why this isn't working is beyond me. I believe both the HWND and HINSTANCE involved are valid...
Thanks