View Single Post
  #1 (permalink)  
Old 02-09-2008, 10:49 AM
Gaski Gaski is offline
Newbie
 
Join Date: Feb 2008
Posts: 1
Rep Power: 0
Gaski is on a distinguished road
Default Problem with drawing functions

Hi,
I have an application, that is drawing a simple text on my desktop.
I have two button created on desktop, and when i click one of them the text is displayed. It should be displayed all the time, but when I put something on it (for example if I move an icon into the text area), , the text dissapears.

I'm using global hook to see if the button is pressed.
My painting code :
Delphi Code:
  1. //if hook catch an WM_PAINT message it sends a message to application // application code when the WM_PAINT message is found:
  2.  
  3.   DC := BeginPaint(GetDesktopListViewHandle, PS);
  4.       SetBkMode(DC, TRANSPARENT);
  5.       SetTextColor(DC, RGB(0, 0, 0));
  6.       TextOut(DC, 1024 - 200, i, Pchar(s), Length(s));
  7.       EndPaint(GetDesktopListViewHandle, PS);

and the GetDesktopListViewHandle function looks :

Delphi Code:
  1. function GetDesktopListViewHandle: THandle;
  2. var
  3.   S: String;
  4. begin
  5.       Result := FindWindow('ProgMan', nil);
  6.       Result := GetWindow(Result, GW_CHILD);
  7.       Result := GetWindow(Result, GW_CHILD);
  8.       SetLength(S, 40);
  9.       GetClassName(Result, PChar(S), 39);
  10.       if PChar(S) <> 'SysListView32' then
  11.       Result := 0;
  12. end;

I must redraw the text, when something is put on it, but i don't know after what message should I redraw it, and how ?

Please help.
Reply With Quote

Sponsored Links