If i do it like this , with use of bitbtl , i get a part of the screen back instead of the window. And it still seems to be in 256 colors. :/
Code:
HDC doBitmap(HWND hwnd) {
int result;
int height = getHeight(hwnd);
int width = getWidth(hwnd);
HDC hdc = GetWindowDC(hwnd);
if (hdc)
{
HDC hdcMem = CreateCompatibleDC(hdc);
if (hdcMem)
{
HBITMAP hbitmap = CreateCompatibleBitmap(hdc, width,height);
if (hbitmap) {
SelectObject(hdcMem, hbitmap);
BitBlt(hdcMem, 0, 0, width, height, hdc, 0, 0, SRCCOPY);
HBITMAP* hOrigBmp=(HBITMAP*)SelectObject(hdc,hbitmap);
SelectObject(hdc,hOrigBmp);
DeleteObject(hbitmap);
return hdcMem;
}
DeleteObject(hdcMem);
}
ReleaseDC(hwnd, hdc);
}
return 0;
}