Click to See Complete Forum and Search --> : CreateCompatibleBitmap doesn´t work


kakalake
December 23rd, 2002, 08:37 AM
Hallo!
I have the following problem. I want to move the "clientArea" of a program with another program. I have the following code.

...
RECT mRect;

HWND hwnd = FindWindow( NULL, "Flash" );
::GetClientRect( hwnd, &mRect );

HDC hdc_desktop = ::GetDC( hwnd );
HDC hdcMem = ::CreateCompatibleDC( hdc_desktop );

HBITMAP bmp = ::CreateCompatibleBitmap( hdc_desktop, mRect.right, mRect.bottom);
::SelectObject( hdcMem, bmp);

::SetTextColor( hdcMem, COLORREF( 0xFFFFFF ) );
::SetBkColor( hdcMem, COLORREF(0xFFFF00));

::TextOut( hdcMem, 0, 0, "Hallo windows", 13 );
BitBlt( hdc_desktop, 0, 0, mRect.right, mRect.bottom, hdcMem, 0, 0, SRCCOPY );
...


But this doesn´t work. The bitmap i get with createCompatibleBitmap and that i am blitting to the window seems to be a black bitmap. Where is my mistake? The text i am writing to the bitmap is correct!

Thanks