procedure tform1.wndproc(var msg:tmessage);
var
p:tpoint;
begin
case msg.msg of
wm_user+1:
case msg.LParam of
wm_rbuttondown:
begin
getcursorpos(p);
popupmenu1.Popup(p.X,p.Y);
end;
WM_LBUTTONDBLCLK:
begin
form1.Show;
showwindow(application.Handle ,sw_hide);
end;
end;
end;
inherited;
end;
type
TCycleEvent = procedure(Sender: TObject; Current: Integer) of object;
TMainFormMinimizeEvent = procedure(Sender: TObject; var GotoTray: Boolean) of object;
type
TCycleEvent = procedure(Sender: TObject; Current: Integer) of object;
TMainFormMinimizeEvent = procedure(Sender: TObject; var GotoTray: Boolean) of object;
begin
if (Message.WParam =SC_MINIMIZE) or (Message.WParam =SC_CLOSE ) then
begin
lpData := new(PNotifyIconDataA);
lpData.cbSize := 88;
lpData.Wnd := self.Handle;
lpData.hIcon := application.icon.Handle;
lpData.uCallbackMessage := WM_BARICON;
lpData.uID :=0;
lpData.szTip := '¹ÜÀíϵͳ·þÎñÆ÷¶Ë';
lpData.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;
Shell_NotifyIcon(NIM_ADD,lpData);
hide;
end;
end;
procedure Tjs_server.WMBarIcon(var Message: TMessage);
begin
{ if (Message.LParam = WM_LBUTTONDOWN) then
begin
if InputBox('µÇ¼', 'ÇëÊäÈë¿ÚÁî ', '')<>'12345' then exit ;
Shell_NotifyIcon(NIM_DELETE,lpData);
dispose(lpData);
show;
end;}
if (Message.LParam = WM_LBUTTONDOWN) then
begin
Shell_NotifyIcon(NIM_DELETE,lpData);
dispose(lpData);
show;
end;
if (Message.LParam = WM_RBUTTONDOWN) then
begin
PopupMenu1.Popup(Mouse.CursorPos.X,Mouse.CursorPos.Y);
end;
end;