A
Abhishek
Hi All,
how do I find the handle of a child window and get a screenshot of that
in a hbitmap at present i tried the below method but am getting the
screenshot of the desktop. the Egyptian Addiction is the name of the game
and the mozillacontentwindowclass is the handle i need who's window i want
to capture
int nScreenWidth = 300;
int nScreenHeight = 225;
//hwnd1 = FindWindow( NULL, "Egyptian Addiction" );
HWND hDesktopWnd = FindWindow( NULL, "MozillaContentWindowClass" );
HDC hDesktopDC = GetDC(hDesktopWnd);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC, nScreenWidth,
nScreenHeight);
SelectObject(hCaptureDC,hCaptureBitmap);
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,hDesktopDC,0,0,SRCCOPY);
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
return hCaptureBitmap;
regards
Abhishek
how do I find the handle of a child window and get a screenshot of that
in a hbitmap at present i tried the below method but am getting the
screenshot of the desktop. the Egyptian Addiction is the name of the game
and the mozillacontentwindowclass is the handle i need who's window i want
to capture
int nScreenWidth = 300;
int nScreenHeight = 225;
//hwnd1 = FindWindow( NULL, "Egyptian Addiction" );
HWND hDesktopWnd = FindWindow( NULL, "MozillaContentWindowClass" );
HDC hDesktopDC = GetDC(hDesktopWnd);
HDC hCaptureDC = CreateCompatibleDC(hDesktopDC);
HBITMAP hCaptureBitmap =CreateCompatibleBitmap(hDesktopDC, nScreenWidth,
nScreenHeight);
SelectObject(hCaptureDC,hCaptureBitmap);
BitBlt(hCaptureDC,0,0,nScreenWidth,nScreenHeight,hDesktopDC,0,0,SRCCOPY);
ReleaseDC(hDesktopWnd,hDesktopDC);
DeleteDC(hCaptureDC);
DeleteObject(hCaptureBitmap);
return hCaptureBitmap;
regards
Abhishek