hennep
Programmer
- Dec 10, 2000
- 429
I tried to capture the desktop into an TImage control using this code:
But I definitely don't know what i am doing. Why doesn't it work ?
Code:
void __fastcall TForm1::FormCreate(TObject *Sender) {
HANDLE h1, h2;
long w, h;
RECT rect;
GetWindowRect( GetDesktopWindow(), &rect );
w = rect.right - rect.left;
h = rect.bottom - rect.top;
h1 = GetDC( GetDesktopWindow() );
h2 = GetDC( Image1->Picture->Bitmap->Handle );
BitBlt( h2, 0, 0, w, h, h1, 0, 0, SRCCOPY );
}