PDA

View Full Version : OpenGL snapshot



BoRiSGz
07-23-2009, 02:16 AM
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\n");
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\n");
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.

yooyo
07-23-2009, 06:11 PM
Search for TAKSI project on sourceforge.. same as fraps, but opensource.

BoRiSGz
07-24-2009, 08:52 AM
Thank you!
I'll check it right now.