![]() |
Delphi-Version: 10.4 Sydney
Windows Notification Reaktion
Hi,
ich habe eine Verständnis Frage bzgl (Windows)-Notifications. Einfacher ist vermutlich wenn ich erkläre, was ich erreichen möchte. Wenn ein Benutzer auf eine gesendete Notification klickt, möchte ich eine Action ausführen (einen Link öffnen oder ein ShellExecute). In RecieveLocalNotification komme ich aber nur, wenn die Notification noch gezeigt wird. Befindet sich die Notification nicht mehr auf dem Bildschirm, sondern wird nur noch im Benachrichtigungs-Teil von Windows angezeigt, funktioniert das ganze nicht mehr. Lässt sich das überhaupt umsetzen? Vielen Dank
Delphi-Quellcode:
unit Unit1;
interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, System.Notification; type TForm1 = class(TForm) btnSendNotification: TButton; procedure FormCreate(Sender: TObject); procedure btnSendNotificationClick(Sender: TObject); private { Private-Deklarationen } ANotificationCenter: TNotificationCenter; procedure RecieveLocalNotification(Sender: TObject; ANotification: TNotification); public { Public-Deklarationen } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.btnSendNotificationClick(Sender: TObject); begin var tmpNotification: TNotification; tmpNotification := TNotification.Create; tmpNotification.Name := 'Windows Notification'; tmpNotification.Title := 'My first Notification'; tmpNotification.AlertBody := 'Notification send by my application.'; ANotificationCenter.PresentNotification(tmpNotification); end; procedure TForm1.FormCreate(Sender: TObject); begin ANotificationCenter := TNotificationCenter.Create(Self); ANotificationCenter.OnReceiveLocalNotification := RecieveLocalNotification; end; procedure TForm1.RecieveLocalNotification(Sender: TObject; ANotification: TNotification); begin Beep; end; end. |
AW: Windows Notification Reaktion
Nein, du machst alles richtig ... von dort kommt das Event einfach nie.
Es hilft auch kein
Delphi-Quellcode:
.
tmpNotification.HasAction := True;
|
AW: Windows Notification Reaktion
Wenn man
![]() |
AW: Windows Notification Reaktion
Schonmal gut zu wissen, dass es eine fehlender Implementierung ist und ich nicht einfach zu blöd bin :D
Hab zwei Beiträge in die Richtung gefunden: ![]() ![]() Ggf. noch ![]() Da eine saubere Implementierung aber vmtl etwas mehr Aufwand ist, werd ich das ganze wohl erstmal ruhen lassen und zu gegebener Zeit darauf zurück kommen. |
AW: Windows Notification Reaktion
Von Marco Canto gibt es auf seinem
![]() Leider auch da ohne das was der TE sich wünscht. |
Alle Zeitangaben in WEZ +1. Es ist jetzt 22:13 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz