Registriert seit: 13. Apr 2010
7 Beiträge
|
Re: MessageBox mit timeout in einer Windows Notify DLL
13. Apr 2010, 09:56
Hallo, danke erstmal für die schnellen Antworten.
Ich probier es erstmal nach der Methode von Sirius, ich bekomme aber einen Fehler beim Compilieren "[DCC Fehler] E1026 Datei nicht gefunden: 'Unit2.dfm'". Hier mein Code:
Delphi-Quellcode:
library Project1;
uses
Windows,
Messages,
SysUtils,
Variants,
Classes,
Graphics,
Controls,
Forms,
Dialogs,
StdCtrls,
Registry,
ShellApi,
Unit2 in 'Unit2.pas' {$R *.res};
{$R *.res}
type
PFNMSGECALLBACK = function (bVerbose: BOOL; lpMessage: PWideChar):
DWORD; stdcall;
{$EXTERNALSYM PFNMSGECALLBACK}
TFnMsgeCallback = PFNMSGECALLBACK;
PWLX_NOTIFICATION_INFO = ^WLX_NOTIFICATION_INFO;
{$EXTERNALSYM PWLX_NOTIFICATION_INFO}
_WLX_NOTIFICATION_INFO = record
Size: ULONG;
Flags: ULONG;
UserName: PWideChar;
Domain: PWideChar;
WindowStation: PWideChar;
hToken: THandle;
hDesktop: HDESK;
pStatusCallback: PFNMSGECALLBACK;
end;
{$EXTERNALSYM _WLX_NOTIFICATION_INFO}
WLX_NOTIFICATION_INFO = _WLX_NOTIFICATION_INFO;
{$EXTERNALSYM WLX_NOTIFICATION_INFO}
TWlxNotificationInfo = WLX_NOTIFICATION_INFO;
PWlxNotificationInfo = PWLX_NOTIFICATION_INFO;
var MessageForm:TForm2;
procedure NotifyLogon(pInfo: PWLX_NOTIFICATION_INFO); stdcall;
begin
MessageForm:=TForm2.Create(nil);
Messageform.Label1.Caption:='Meine Meldung';
Messageform.Show;
end;
exports
NotifyLogon;
begin
end.
Zum Projekt hinzugefühgt hab ich Unit2:
Delphi-Quellcode:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls;
type
TForm2 = class(TForm)
Label1: TLabel;
Timer1: TTimer;
Button1: TButton; //enabled auf false
procedure Timer1Timer(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure Button1Click(Sender: TObject);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Timer1Timer(Sender: TObject);
begin
close;
end;
procedure TForm2.FormShow(Sender: TObject);
begin
timer1.Enabled:=true;
end;
procedure TForm2.FormClose(Sender: TObject; var Action: TCloseAction);
begin
Action:=caFree;
end;
procedure TForm2.Button1Click(Sender: TObject);
begin
close;
end;
end.
|
|
Zitat
|