K
Kodiak
I am passing in a reference to a window handle, followed by the height
and width as well into my method. I am then creating a Device Context
using the window handle and converting the window in a bitmap saved in
memory. What I am trying to accomplish is generating a checksum value
and returning that value from the bitmap stored in memory, but I cannot
solve this problem. The method is designed to given a window handle,
height, and width, take an image of the window, and return the checksum
value. I am trying to check to see if the window changes by using the
checksum values. Any help with this method and problem is greatly
appreciated! Please see the code below for what I have done so far!
STDMETHODIMP CCaptureBitmap::BitmapResult(DWORD hWnd, int height, int
width, long *pIndex)
{
HDC hdc, hdcMem;
HBITMAP bitmap;
int y = 0;
y = (4 * height) / 5;
hdc = GetDC((HWND)hWnd);
hdcMem = CreateCompatibleDC(hdc);
bitmap = CreateCompatibleBitmap(hdcMem, width, height);
SelectObject(hdcMem, bitmap);
BitBlt(hdcMem, 0, 0, width, y, hdc, 0, 0, SRCCOPY);
//Need to add code here to generate checksum value.
ReleaseDC((HWND)hWnd, hdc);
return S_OK;
}
and width as well into my method. I am then creating a Device Context
using the window handle and converting the window in a bitmap saved in
memory. What I am trying to accomplish is generating a checksum value
and returning that value from the bitmap stored in memory, but I cannot
solve this problem. The method is designed to given a window handle,
height, and width, take an image of the window, and return the checksum
value. I am trying to check to see if the window changes by using the
checksum values. Any help with this method and problem is greatly
appreciated! Please see the code below for what I have done so far!
STDMETHODIMP CCaptureBitmap::BitmapResult(DWORD hWnd, int height, int
width, long *pIndex)
{
HDC hdc, hdcMem;
HBITMAP bitmap;
int y = 0;
y = (4 * height) / 5;
hdc = GetDC((HWND)hWnd);
hdcMem = CreateCompatibleDC(hdc);
bitmap = CreateCompatibleBitmap(hdcMem, width, height);
SelectObject(hdcMem, bitmap);
BitBlt(hdcMem, 0, 0, width, y, hdc, 0, 0, SRCCOPY);
//Need to add code here to generate checksum value.
ReleaseDC((HWND)hWnd, hdc);
return S_OK;
}