var
icondata:TNOTIFYICONDATA;
procedure TfrmSrvMain.FillDataStructure;
begin
with IconData do 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 := Self.Icon.Handle;
StrPCopy(szTip,'会员服务程序');
uCallbackMessage := WM_TOOLTRAYICON;
end;
end;
Self.Hide;
FillDataStructure;
Shell_NotifyIcon(NIM_Add,@IconData);
还有在程序中加上uses shellapi