Delphi-Quellcode:
procedure ShowTrayMessage(
const TheMessage:
String);
var
H: HWND;
Rec: TRect;
NeededTop: Integer;
HintForm: TForm;
HintLabel: TLabel;
aw: hwnd;
begin
H := FindWindow('
Shell_TrayWnd',
nil);
if h <> 0
then
begin
GetWindowRect(h, Rec);
HintForm := TForm.Create(
nil);
with HintForm
do
begin
Width := 245;
Height := 100;
Color := clSkyBlue;
BorderStyle := bsNone;
FormStyle := fsStayOnTop;
HintLabel := TLabel.Create(
nil);
with HintLabel
do
begin
Parent := HintForm;
WordWrap := true;
Font.
Name := '
Fixedsys';
Font.Style := [fsBold];
Font.Pitch := fpFixed;
Font.Size := 9;
Caption := '
' + Trim(TheMessage) + '
';
Align := alClient;
Layout := tlCenter;
Alignment := taCenter;
end;
AlphaBlend := true;
AlphaBlendValue:=220;
aw := GetActiveWindow;
ShowWindow(
handle, SW_SHOWNOACTIVATE);
SetActiveWindow(aw);
Left := Screen.Width - Width;
Top := Screen.Height - 20;
NeededTop := Rec.Top - Height;
while Top > NeededTop
do
begin
Top:=Top - 2;
Repaint;
Sleep(10);
end;
Sleep(3000);
NeededTop := Screen.Width - 20;
while Top < NeededTop
do
begin
Top:=Top + 2;
Repaint;
Sleep(10);
end;
HintLabel.Free;
Free;
end;
end;
end;
So sieht das ganze momentan aus, ja Du magst kein "with", das ist dennoch erstmal meine Ausgangsbasis um daraus ne Threaded Klasse zu erschaffen.
Es gibt viel zu tun, also fangen wir was an