Hi there!
I am trying to take a snapshot from another process, to be exact Counter-Strike.
Under Windown XP I could take simple snapshots using GDI functions, but it doesn’t work under Windows Vista/7 because of the new look of the Windows.
I have tried getting the HDC and HRC of the other process, but it seems I cant get the HRC. I got the HDC using this code:
hwnd = FindWindowA(0, “Counter-Strike”);
if (!hwnd)
{
printf("Open Counter-Strike to begin
");
while (1)
{
Sleep(1000);
hwnd = FindWindowA(0, “Counter-Strike”);
if (hwnd) break;
}
}
DWORD proc_id;
GetWindowThreadProcessId(hwnd, &proc_id);
hProcess = OpenProcess(PROCESS_ALL_ACCESS, FALSE, proc_id);
if (!hProcess)
{
printf("Cant Open Process
");
return 2;
}
*hDC = GetDC( hWnd );
now because I dont have an HRC when I am trying to use glReadPixels, it doesnt work.
I saw this feature in a program named Fraps, and started looking for a solution some time ago, so now I thought you guys may be able to figure out how it is possible to be done.
Boris.