uses ShellApi;
var
ATray:PNotifyIconData;function AddTrayIcon(Handle:HWND;ICON:HICON;Hint:string):Boolean;
Begin
try
New(ATray);
ATray.cbSize:=Sizeof(ATray^);
ATray^.Wnd:=Handle;
ATray^.uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
ATray^.uCallbackMessage:=WM_TRAYICON;
ATray^.hIcon:=Icon;
strPCopy(ATray^.szTip,Hint);
Result:=Shell_NotifyIcon(NIM_ADD,ATray);
Except
Result:=False;
end;
End;function ModiTrayIcon(Icon:HICON;Hint:string):Boolean;
begin
try
ATray^.hIcon:=Icon;
strPCopy(ATray^.szTip,Hint);
Result:=Shell_NotifyIcon(NIM_MODIFY,ATray);
Except
Result:=False;
end;
end;Function RemoveTrayIcon():Boolean;
Begin
try
Result:=Shell_NotifyIcon(NIM_DELETE,ATray);
Except
Result:=False;
end;
Dispose(ATray);
End;
var
ATray:PNotifyIconData;function AddTrayIcon(Handle:HWND;ICON:HICON;Hint:string):Boolean;
Begin
try
New(ATray);
ATray.cbSize:=Sizeof(ATray^);
ATray^.Wnd:=Handle;
ATray^.uFlags:=NIF_MESSAGE or NIF_ICON or NIF_TIP;
ATray^.uCallbackMessage:=WM_TRAYICON;
ATray^.hIcon:=Icon;
strPCopy(ATray^.szTip,Hint);
Result:=Shell_NotifyIcon(NIM_ADD,ATray);
Except
Result:=False;
end;
End;function ModiTrayIcon(Icon:HICON;Hint:string):Boolean;
begin
try
ATray^.hIcon:=Icon;
strPCopy(ATray^.szTip,Hint);
Result:=Shell_NotifyIcon(NIM_MODIFY,ATray);
Except
Result:=False;
end;
end;Function RemoveTrayIcon():Boolean;
Begin
try
Result:=Shell_NotifyIcon(NIM_DELETE,ATray);
Except
Result:=False;
end;
Dispose(ATray);
End;
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货