可以举例如下进行参考:
// Add Uses ShellAPI
const
WM_TOOLTRAYICON = WM_USER + 100;
var
IconData: TNOTIFYICONDATA;
//对IconData进行赋值
with IconDatado
begin
cbSize := SizeOf(TNOTIFYICONDATA);
wnd := Self.Handle;
uID := 0;
// is not passed in with message so make it 0
uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP;
hIcon := Application.Icon.Handle;
szTip := '请单击鼠标右键';
uCallbackMessage := WM_TOOLTRAYICON;
end;
Shell_NotifyIcon(NIM_Add, @IConData)//Add Icon to TrayIcon
Shell_NotifyIcon(NIM_Del, @IConData)