TDesktopCanvas - draw on Windows Desktop
This canvas class allows you to access the Windows Desktop, and draw on it.
~~~~~~~~~~~~~~~~~~~~~~~~~
type
  TDesktopCanvas = class(TCanvas)
  private
    DC : hDC;
    function GetWidth:Integer;
    function GetHeight:Integer;
  public
    constructor Create;
    destructor Destroy; override;
  published
    property Width: Integer read GetWidth;
    property Height: Integer read GetHeight;
  end;
{ TDesktopCanvas object }
function TDesktopCanvas.GetWidth:Integer;
begin
  Result:=GetDeviceCaps(Handle,HORZRES) ;
end;
function TDesktopCanvas.GetHeight:Integer;
begin
  Result:=GetDeviceCaps(Handle,VERTRES) ;
end;
constructor TDesktopCanvas.Create;
begin
  inherited Create;
  DC := GetDC(0) ;
  Handle := DC;
end;
destructor TDesktopCanvas.Destroy;
begin
  Handle := 0;
  ReleaseDC(0, DC) ;
  inherited Destroy;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» Hiding Minimized MDI Child Windows
« Get Last Day in Month
~~~~~~~~~~~~~~~~~~~~~~~~~
type
  TDesktopCanvas = class(TCanvas)
  private
    DC : hDC;
    function GetWidth:Integer;
    function GetHeight:Integer;
  public
    constructor Create;
    destructor Destroy; override;
  published
    property Width: Integer read GetWidth;
    property Height: Integer read GetHeight;
  end;
{ TDesktopCanvas object }
function TDesktopCanvas.GetWidth:Integer;
begin
  Result:=GetDeviceCaps(Handle,HORZRES) ;
end;
function TDesktopCanvas.GetHeight:Integer;
begin
  Result:=GetDeviceCaps(Handle,VERTRES) ;
end;
constructor TDesktopCanvas.Create;
begin
  inherited Create;
  DC := GetDC(0) ;
  Handle := DC;
end;
destructor TDesktopCanvas.Destroy;
begin
  Handle := 0;
  ReleaseDC(0, DC) ;
  inherited Destroy;
end;
~~~~~~~~~~~~~~~~~~~~~~~~~
Delphi tips navigator:
» Hiding Minimized MDI Child Windows
« Get Last Day in Month
Source...