1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| procedure TFrmWindowsRegions.BtnDrawOnDesktopClick(Sender: TObject);
var
hDesktopWindow: HWND;
hDesktopWindowDC: HDC;
hSolidBrush: HBRUSH;
begin
// GetDesktopWindow() fourni le Handle du Bureau
// GetWindowDC(...) si tu lui fourni le Handle du Bureau, tu obtiens une sorte de Canvas pour dessiner dessus
// DrawFrameControl(...) tu lui fourni ton Canvas, et ça devrait simuler le dessin d'une fenêtre ...
// ReleaseDC(...) Comme d'habitude, on laisse la place propre ...
hDesktopWindow := GetDesktopWindow();
hDesktopWindowDC := GetWindowDC(HDesktopWindow);
if hDesktopWindowDC > 0 then
begin
hSolidBrush := CreateSolidBrush($00FF0000);
FrameRect (hDesktopWindowDC, Rect(0, 0, 100, 100), hSolidBrush);
DeleteObject(hSolidBrush);
DrawFrameControl(hDesktopWindowDC, Rect(10, 10, 90, 90), DFC_BUTTON, 0);
ReleaseDC(hDesktopWindow, hDesktopWindowDC);
end;
end; |
Partager