Mega Code Archive

 
Categories / Delphi / API
 

How can i draw directly on the windows desktop

Question: How can I draw directly on the Windows Desktop? Answer: The following example uses the dc returned from GetDc(0) with the Windows API drawing functions to draw on the Windows Desktop. Example: procedure TForm1.Button1Click(Sender: TObject); var dc : hdc; begin dc := GetDc(0); MoveToEx(Dc, 0, 0, nil); LineTo(Dc, 300, 300); ReleaseDc(0, Dc); end;