Hello!
I am drawing to the windows desktop by this way:
var
Handle: HWND;
Dc: HDC;
ACanvas: TCanvas;
Text: string;
begin
Text := 'Some text to show';
Handle := GetDesktopWindow;
Dc := GetWindowDC(Handle) ;
ACanvas := TCanvas.Create;
try
ACanvas.Handle := DC;
BeginPath(ACanvas.Handle) ;
ACanvas.Font.Color := clRed;
ACanvas.Font.Name := Text;
ACanvas.Font.Size := 32;
SetBkMode(ACanvas.Handle, TRANSPARENT) ;
EndPath(ACanvas.Handle) ;
ACanvas.TextOut( Round((Screen.Width/2)-(ACanvas.TextWidth(Text)/2)), Round((Screen.Height/2)-(ACanvas.TextHeight(Text)/2)), Text) ;
finally
ACanvas.Free;
end;
It works perfectly but how can i clear that text?
I tried:
InvalidateRect(0, nil, false);
But it didn't work in all situations.
Is there any other way to clear my drawings on desktop?