DelphiFAQ Home Search:

TDesktopCanvas - write on the desktop

 

comments1 comments. Current rating: 3 stars (1 votes). Leave comments and/ or rate it.

This canvas allows you to access the desktop:

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;

Comments:

2006-06-04, 11:22:29
[hidden] from United Kingdom  
rating
Anyone really had a good use for this ?
I have been trying to find a way of picking up when windows sends repaint messages to the desktop so that what I write stays there. Subclassing used to work, I think, but all I get from XP is access denied when I call GetWindowLong(GetDc(0), GWL_WNDPROC))
Any ideas ?

 

 

Email address (not necessary):

Rate as
Hide my email when showing my comment.
Please notify me once a day about new comments on this topic.
Please provide a valid email address if you select this option.
 
It seems that you are
from Los Angeles, US .

Info/ Feedback on this

Show city and country
Show country only
Hide my location
You can mark text as 'quoted' by putting [quote] .. [/quote] around it.
Please type in the code:
photo Add a picture:

Please do not post inappropriate pictures. Inappropriate pictures include pictures of minors and nudity. The owner of this web site reserves the right to delete such material.