您正在看的DELPHI是:How can I create a tray icon。
;
{ Remove the icon from the system tray.} destructor TTrayIcon.Destroy; begin fIcon.Free; if not (csDesigning in ComponentState) then Shell_NotifyIcon(Nim_Delete, @fData); inherited Destroy; end; { Whenever any information changes, update the system tray. } procedure TTrayIcon.Changed; begin if not (csDesigning in ComponentState) then Shell_NotifyIcon(NIM_MODIFY, @fData); end; { When the Application is minimized, minimize to the system tray.} procedure TTrayIcon.AppMinimize(Sender: TObject); begin Minimize end; { When restoring from the system tray, restore the application. } procedure TTrayIcon.AppRestore(Sender: TObject); begin Restore end; { Message handler for the hidden shell notification window. Most messages use Wm_Callback_Message as the Msg ID, with WParam as the ID of the shell notify icon data. LParam is a message ID for the actual message, e.g., Wm_MouseMove. Another important message is Wm_EndSession, telling the shell notify icon to delete itself, so Windows can shut down. Send the usual Delphi events for the mouse messages. Also interpolate the OnClick event when the user clicks the left button, and popup the menu, if there is one, for right click events. } procedure TTrayIcon.OnMessage(var Msg: TMessage); { Return the state of the shift keys. } function ShiftState: TShiftState; begin Result := []; if GetKeyState(VK_SHIFT) < 0 then Include(Result, ssShift); if GetKeyState(VK_CONTROL) < 0 then Include(Result, ssCtrl); if GetKeyState(VK_MENU) < 0