System tray
Желательно с всеми дополнительными компонентами...
Буду очень благодарен. Triboy
WM_NOTIFYTRAYICON = WM_USER + 1;
private
{ Private declarations }
procedure WMTRAYICONNOTIFY(var Msg: TMessage);
message WM_NOTIFYTRAYICON;
procedure TForm1.FormCreate(Sender: TObject);
Ic := TIcon.Create;
Ic.LoadFromFile('1.ico');
with tray do begin
cbSize := SizeOf(TNotifyIconData);
Wnd := Form1.Handle;
uID := 1;
uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
uCallBackMessage := WM_NOTIFYTRAYICON;
hIcon := Ic.Handle;
szTip := ('TimeLimit-ограничитель времени');
end;
Shell_NotifyIcon(NIM_ADD, Addr(tray));
Ic.Destroy;
procedure TForm1.FormDestroy(Sender: TObject);
var
tray: TNotifyIconData;
begin
UnRegisterHotkey( Handle, 1 );
with tray do begin
cbSize := SizeOf(TNotifyIconData);
Wnd := Form1.Handle;
uID := 1;
end;
Shell_NotifyIcon(NIM_DELETE, Addr(tray));
end;
procedure TForm1.WMTRAYICONNOTIFY(var Msg: TMessage);
var
s: String;
P : TPoint;
begin
case Msg.LParam of
WM_MOUSEMOVE: s := '';
WM_LBUTTONDOWN:
begin
GetCursorPos(p);
SetForegroundWindow(Application.MainForm.Handle);
PopupMenu1.Popup(P.X, P.Y);
end;
WM_LBUTTONUP: s := '';
WM_LBUTTONDBLCLK: s := '';
WM_RBUTTONDOWN: s := '';
WM_RBUTTONUP: s := '';
WM_RBUTTONDBLCLK: s := '';
else s := IntToStr(Msg.LParam);
end;
прошу прощения,если будут ошибки