Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

[Delphi]Trayicon und drag n´drop?

Empfohlene Antworten

Hallo,

kann ein Trayicon in Windows 2000/XP auch auf Drag n` Drop reagieren? Wenn ja wie?

Hoffe ihr habt eine Idee

Vielen Dank

Dragi

Hallo,

kann ein Trayicon in Windows 2000/XP auch auf Drag n` Drop reagieren? Wenn ja wie?

'also ich hab es noch nich probiert, aber hier mal meine Idee:

Angelegt hab ich ein Try-Icon auf die Art:



Type


  TNewNotifyIconData = record

    cbSize: DWORD;

    Wnd: HWND;

    uID: UINT;

    uFlags: UINT;

    uCallbackMessage: UINT;

    hIcon: HICON;

   //Version 5.0 is 128 chars, old ver is 64 chars

    szTip: array [0..127] of Char;

    dwState: DWORD; //Version 5.0

    dwStateMask: DWORD; //Version 5.0

    szInfo: array [0..255] of Char; //Version 5.0

    DUMMYUNIONNAME: TDUMMYUNIONNAME;

    szInfoTitle: array [0..63] of Char; //Version 5.0

    dwInfoFlags: DWORD;   //Version 5.0

  end;


...


IconData: TNewNotifyIconData;


...


procedure TForm1.AddSysTrayIcon;

begin

  IconData.cbSize := SizeOf(IconData);

  IconData.Wnd := AllocateHWnd(SysTrayIconMsgHandler);

  {SysTrayIconMsgHandler is then callback message' handler}

  IconData.uID := 0;

  IconData.uFlags := NIF_ICON or NIF_MESSAGE or NIF_TIP;

  IconData.uCallbackMessage := TRAY_CALLBACK;   //user defined callback message

  IconData.hIcon := Application.Icon.Handle;    //an Icon's Handle

  IconData.szTip := 'Tooltip';

  if not Shell_NotifyIcon(NIM_ADD, @IconData) then

    ShowMessage('add failed');

end;


Auf Windows-Messages reagiert das Icon über die Nachricht TRAY_CALLBACK

procedure SysTrayIconMsgHandler(var Msg: TMessage); message TRAY_CALLBACK;


...


procedure TfrmInfo.SysTrayIconMsgHandler(var Msg: TMessage);

var Point: TPoint;

begin

//  if Msg.lParam <> WM_MOUSEMOVE then

  case Msg.lParamLo of

    WM_MOUSEMOVE:;

    WM_LBUTTONDOWN:

      MessageBeep(0);

    WM_LBUTTONUP:;

    WM_LBUTTONDBLCLK:

      frmMain.show;

    WM_RBUTTONDOWN:

    begin

      GetCursorPos(Point);

      //*** Wichtig! Damit sich das Menü schliesst wenn die Maus irgendwo gedrückt wird

      SetForegroundWindow(Self.Handle);

      frmMain.mnuTray.PopUp(Point.x, Point.y);

    end;

    WM_RBUTTONUP:;

    WM_RBUTTONDBLCLK:;

  end;

end;


Auszug aus der Win-Hilfe:

The DragAcceptFiles function registers whether a window accepts dropped files.

Also uber DragAcceptFiles dein TrayIcon (Wnd: hWnd) registrieren und dann die WindowsMessage WM_DROPFILES in der Prozedur abfragen.

Das müsste so eigentlich gehen...

Hallo,

vielen Dank für den Code. Leider sperrt die traybar immer noch das Drag´n Drop.

Wahrscheinlich ist das einfach nicht möglich :'(

Gruss

Dragi

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Konto

Navigation

Suchen

Suchen

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.