您正在看的DELPHI是:How can I create a tray icon。
; procedure TTrayIcon.DoMouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if Assigned(fOnMouseUp) then fOnMouseUp(Self, Button, Shift, X, Y); end; { When the application minimizes, hide it, so only the icon in the system tray is visible. } procedure TTrayIcon.Minimize; begin ShowWindow(Application.Handle, SW_HIDE); if Assigned(fOnMinimize) then fOnMinimize(Self); end; { Restore the application by making its window visible again, which is a little weird since its window is invisible, having no height or width, but that's what determines whether the button appears on the taskbar. } procedure TTrayIcon.Restore; begin ShowWindow(Application.Handle, SW_RESTORE); if Assigned(fOnRestore) then fOnRestore(Self); end; { Allow Windows to exit by deleting the shell notify icon. } procedure TTrayIcon.EndSession; begin Shell_NotifyIcon(Nim_Delete, @fData); end; procedure Register; begin RegisterComponents('Tempest', [TTrayIcon]); end; end.