Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 1

private

TrayIconData: TNotifyIconData;
{ Private declarations }
public
procedure TrayMessage(var Msg: TMessage);
message WM_ICONTRAY;
{ Public declarations }
end;
with TrayIconData do
begin
cbSize := SizeOf(TrayIconData);
Wnd := Handle;
uID := 0;
uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
uCallbackMessage := WM_ICONTRAY;
hIcon := Application.Icon.Handle;
StrPCopy(szTip, Application.Title);
end;
Shell_NotifyIcon(NIM_ADD, @TrayIconData);
Form1.Hide;
procedure TForm1.TrayMessage(var Msg: TMessage);
begin
case Msg.lParam of
WM_LBUTTONDOWN:
begin
Shell_NotifyIcon(NIM_DELETE, @TrayIconData);
Form1.Show;
end;
end;
end;

You might also like