hi!
danke dir auch. Das Zauberwort ist TNOTIFYICONDATA.
Delphi-Quellcode:
const WM_ICONACTION = WM_USER + 100;
procedure CreateIcon(Icon: TIcon; Tip: String);
var
IconData : TNOTIFYICONDATA;
begin
with IconData do begin
cbSize := sizeof(TNOTIFYICONDATA);
wnd := self.handle;
uID := 1;
uFlags := NIF_MESSAGE or NIF_ICON or NIF_TIP;
uCallbackMessage := WM_ICONACTION;
hIcon := Icon.Handle;
StrPCopy(szTip,Tip);
end;
Shell_NotifyIcon(NIM_ADD,@IconData);
end;
Dann kannst du WM_ICONACTION abfangen:
Delphi-Quellcode:
procedure tForm1.WMICONACTION(var message:TMessage);
var MouseCo: Tpoint;
begin
with message do
begin
GetCursorPos(MouseCo);
// Koordinaten in MouseCo.x und MouseCo.y
case lParamLo of
0:; // MouseMove
WM_LBUTTONDBLCLK : ;
WM_RBUTTONUp :
PopupMenu1.Popup(MouseCo.x,MouseCo.y);
end;
end;
end;