Hallo, und Guten Morgen!
Ich habe mal wieder ein Problem. Ich möchte das ein Programm ohne Fenster läuft und nur ein Icon im System Tray hat. Darüber soll dann ein kleines Menü aufgerufen werden. Bis dahin ist alles noch kein Problem.
So trage ich das Icon ein:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| with IconData do begin cbSize := SizeOf(IconData); Wnd := Handle; uID := 0; uFlags := NIF_MESSAGE + NIF_ICON + NIF_TIP; uCallbackMessage := WM_ICONTRAY; hIcon := Form1.Icon.Handle; StrPCopy(szTip, Application.Title); end; Shell_NotifyIcon(NIM_ADD, @IconData); |
So reagiere ich auf das Menü:
Delphi-Quelltext
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11:
| procedure TForm1.TrayMessage(var Msg: TMessage); var curPos : TPoint; begin case Msg.lParam of WM_RBUTTONDOWN: begin GetCursorPos(curPos); PopUpMenu1.Popup(curPos.x, curPos.y); end; end; |
Das Problem ist das es nur auf dem Desktop zu sehen aus dem das Programm gestartet wurde. Ich möchte aber das das Icon auf im Tray auf allen verfügbaren Desktops zu sehen ist. Hat jemand Idee wie man das Umsetzen kann?
Gruß Frank