你能不能查以前的代码?<br>procedure TMainForm.NotifyIcon(var TM : TMessage); //响应鼠标消息<br>var<br> AC : LongInt;<br> CP : TPoint;<br>begin<br> AC:=TM.LParam;<br> if AC=WM_LBUTTONDBLCLK then<br> begin<br> MainForm.Show;<br> end;<br> if AC=WM_RBUTTONDOWN then<br> begin<br> if MainForm.Visible then<br> exit;<br> GetCursorPos (CP);<br><br> PopupMenu1.Popup (CP.X, CP.Y);<br> end;<br>end;<br><br>procedure AddTrayIcon (ID : integer; Hint : string; Icon : TIcon; hWnd : LongInt; CallBack : LongInt);<br>var<br> MC : TNotifyIconData;<br>begin<br> with MC do<br> begin<br> cbSize := sizeof(TNotifyIconData);<br> Wnd := hWnd;<br> uID := ID;<br> uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;<br> uCallbackMessage := CallBack;<br> hIcon := Icon.Handle;<br> if (length(hint)>0) then<br> StrLCopy(szTip, PChar(hint), 63)<br> else<br> szTip[0] := #0;<br> end;<br> if Shell_NotifyIcon(NIM_ADD, @MC) then<br> SetWindowLong(Application.Handle, GWL_EXSTYLE,<br> GetWindowLong(Application.Handle, GWL_EXSTYLE) or WS_DLGFRAME and not WS_EX_APPWINDOW);<br>end;<br><br>procedure DestroyTrayIcon (ID : integer; hWnd : LongInt);<br>var<br> MC : TNotifyIconData;<br>begin<br> with MC do<br> begin<br> cbSize := sizeof(TNotifyIconData);<br> Wnd := hWnd;<br> uID := ID;<br> end;<br> Shell_NotifyIcon (NIM_DELETE, @MC);<br>end;<br><br>AddTrayIcon (1,'IP监视器',Application.Icon,MainForm.Handle,WM_NOTIFYMSG);<br>DestroyTrayIcon (1,MainForm.Handle);