Drawing on the Desktop 

In order to draw on the desktop, you'll need a handle to it's device context.  You can obtain this handle by using the GetDC API call and passing it a NULL parameter, or by using the GetDesktopWindow function to get a handle to the desktop window, then a subsequent call to GetDC, passing it the handle returned from GetDesktopWindow... 

KEYWORDS: TCanvas, GetDC, ReleaseDC 
 

 

//in header file 
TCanvas *DeskTopCanvas;
 
 

 
 

//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender) 

    DesktopCanvas = new TCanvas(); 
    DesktopCanvas->Handle = GetDC(0); 
   //or "DesktopCanvas->Handle = GetDC(GetDesktopWindow());" 

    DesktopCanvas->Draw(50, 50, Image1->Picture->Graphic); 

    ReleaseDC(0, DesktopCanvas->Handle); 

void __fastcall TForm1::FormClose(TObject *Sender, TCloseAction &Action) 

   delete DesktopCanvas;