unit Unit1;
interface
uses
Windows, SysUtils, Classes, Forms, Dialogs, StdCtrls, Controls, Messages;
type
TForm1 =
class(TForm)
procedure FormActivate(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
procedure Minimieren(
var M: TMessage);
message WM_NCLBUTTONDOWN;
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
uses Unit2;
procedure TForm1.FormActivate(Sender: TObject);
begin
sendmessage(Form2.handle, WM_NCACTIVATE, 1, 0);
end;
procedure TForm1.FormShow(Sender: TObject);
begin
Form2.show;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Application.Title := '
Gruppe W1';
Caption := Application.Title;
end;
procedure TForm1.Minimieren(
var M: TMessage);
begin
DefaultHandler(M);
if M.WPARAM = HTREDUCE
then
Form2.windowstate := wsminimized;
end;
end.
--------------------------------------------------------------
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;
type
TForm2 =
class(TForm)
procedure FormActivate(Sender: TObject);
procedure FormClose(Sender: TObject;
var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
private
{ Private-Deklarationen }
public
procedure CreateParams(
var Params: TCreateParams);
override;
procedure Minimieren(
var M: TMessage);
message WM_NCLBUTTONDOWN;
end;
var
Form2: TForm2;
implementation
{$R *.DFM}
procedure TForm2.FormActivate(Sender: TObject);
begin
sendmessage(Application.Mainform.handle, WM_NCACTIVATE, 1, 0);
end;
procedure TForm2.CreateParams(
var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.WndParent := GetDesktopWindow;
end;
procedure TForm2.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
Application.MainForm.close;
end;
procedure TForm2.FormCreate(Sender: TObject);
begin
Caption := '
Gruppe W2';
end;
procedure TForm2.Minimieren(
var M: TMessage);
begin
DefaultHandler(M);
if M.WPARAM = HTREDUCE
then
Application.minimize;
end;
end.