Small application that draws text with transparent background to desktop and after some time it dissapears.
Make an application with one button and make OnClick event:
procedure TForm1.Button1Click(Sender: TObject);
var
Dc: HDC;
ACanvas: TCanvas;
begin
Handle := GetDesktopWindow;
Dc := GetWindowDC(Handle) ;
ACanvas := TCanvas.Create;
try
ACanvas.Handle := DC;
BeginPath(ACanvas.Handle);
ACanvas.Font.Color := clGreen;
ACanvas.Font.Name := 'Sample text';
ACanvas.Font.Size := 20;
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
ReleaseDC(Handle, ACanvas.Handle) ;
ACanvas.Free;
end;
Sleep(500);
InvalidateRect(0, nil, false);
end; Now, run the application. If you have Windows 7, it will not work properly with AERO template. Let's see what it does with and without AERO theme.
With AERO: http://img22.imageshack.us/img22/7549/blamb.pngAnd without AERO (any other theme on Windows 7): http://img203.imageshack.us/img203/1192/beznzvupi.pngHow to fix this?