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 :
[HIGHLIGHT="Delphi"]
//if hook catch an WM_PAINT message it sends a message to application // application code when the WM_PAINT message is found:
DC := BeginPaint(GetDesktopListViewHandle, PS);
SetBkMode(DC, TRANSPARENT);
SetTextColor(DC, RGB(0, 0, 0));
TextOut(DC, 1024 - 200, i, Pchar(s), Length(s));
EndPaint(GetDesktopListViewHandle, PS);
[/HIGHLIGHT]
and the GetDesktopListViewHandle function looks :
[HIGHLIGHT="Delphi"]
function GetDesktopListViewHandle: THandle;
var
S: String;
begin
Result := FindWindow('ProgMan', nil);
Result := GetWindow(Result, GW_CHILD);
Result := GetWindow(Result, GW_CHILD);
SetLength(S, 40);
GetClassName(Result, PChar(S), 39);
if PChar(S) <> 'SysListView32' then
Result := 0;
end;
[/HIGHLIGHT]
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.
This may not be a best solution but u could always create a procedure for Application.OnIdle to redraw the test... its messy i know![]()
Actually i don't have too much idea about it.
this is the difference between drawing on a form and drawing on an image on the form, in the first case you have redraw your shape after each (move, minimize, maximize ...), so you have two solutions:
1- ad an image component to your form and then draw your text on it
2- draw your text in the form.onpaint event
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks