PssCaptureSnapshot newbie
Jan 15, 2017 at 7:45am UTC
Currently trying to use windows API diagnostic process snapshoting, and just trying to understand the windows API reference pages in general.
from reading the overview (
https://msdn.microsoft.com/en-us/lib...(v=vs.85).aspx), i understand that PssCaptureSnapshot will return me a HPSS snapshot handle that allows to see the specified capture flag.
when i call the below function getInfo for age of empires 2 it gets the hwnd and handle fine, when i try to get the HPSS snapshot handle with PssCaptureSnapshot it does not work and the function returns 2.
i posted just the variables and the function,any help would be appreciated.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
class windowsClass
{
private :
HWND hwnd=0;
HANDLE handle=0;
DWORD processId=0;
HPSS shotHandle=0;
DWORD buffer[1024];
public :
windowsClass();
int getInfo(LPCTSTR _windowname);
void queryInfo();
};
int windowsClass::getInfo(LPCTSTR _windowname)
{
hwnd = FindWindow(_windowname,0);
if (hwnd==0) {
return 0;
}
handle = GetWindow(hwnd,0);
if (handle==0) {
return 1;
}
PssCaptureSnapshot(handle,PSS_CAPTURE_HANDLES,0,&shotHandle);
if (shotHandle==0) {
return 2;
CloseHandle(handle);
}
CloseHandle(handle);
return 3;
}
Jan 15, 2017 at 9:13am UTC
Might be worth to check the return value from PssCaptureSnapshot and if it is != ERROR_SUCCESS call GetLastError to see what's wrong.
Topic archived. No new replies allowed.