Registriert seit: 9. Okt 2005
Ort: Somewhere over the Slaughterhouse
132 Beiträge
Delphi 7 Professional
|
Re: Fremde Anwendung ändert Caption
11. Okt 2005, 02:41
Hab's mal kurz getestet. Geht 1a
Anwendung 1:
Delphi-Quellcode:
Unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
begin
PostMessage(HWND_BROADCAST,RegisterWindowMessage(' MuldeR.TestMessages.Terminate'),1,1);
end;
end.
Anwendung 2:
Delphi-Quellcode:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, AppEvnts;
type
TForm1 = class(TForm)
ApplicationEvents1: TApplicationEvents;
procedure ApplicationEvents1Message( var Msg: tagMSG;
var Handled: Boolean);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.ApplicationEvents1Message( var Msg: tagMSG;
var Handled: Boolean);
begin
if Msg. message = RegisterWindowMessage(' MuldeR.TestMessages.Terminate') then
if (Msg.wParam = 1) and (Msg.lParam = 1) then
Application.Terminate;
end;
end.
|
|
Zitat
|