Hi Paul,

For each window in the application you should try trapping WM_SYSCOMMAND
and check if WPARAM equals SC_MINIMIZE. If your test passed then all you
need to do is call Application.Minimize. 

On the flipside, when the application is restored you can send
WM_SYSCOMMAND with SC_RESTORE to all previously activated windows. See
attached code.


Code: 
On child windows.. 

WMSysCommand(var Message: TWMSysCommand);
begin
  if (Message.CmdType and $FFF0 = SC_MINIMIZE) then
    Application.Minimize
  else 
  if (Message.CmdType and $FFF0 = SC_RESTORE) then
    Show
  else inherited;
End;

On Main Form...

Application.OnRestore:= OnRestore;
....
...
OnRestore();
Begin
  for each active form do begin
    SendMessage(Stack[n],WM_SYSCOMMAND, SC_RESTORE, 0); //Stack...
Contains Handles of activated forms
  end;
End;


Hope that helps.
Al.

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
On Behalf Of Paul McKenzie
Sent: Wednesday, 23 June 2004 11:06 a.m.
To: Alistair George; NZ Borland Developers Group- Delphi List
Subject: Re: [DUG] Application Minimise

What I am after is when a user minimises any window within the App the
App itself minimises and the reverse when they restore ...

Regards
Paul McKenzie
SMSS Ltd.
New Zealand.
----- Original Message -----
From: "Alistair Grant George" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 23, 2004 10:26 AM
Subject: Re: [DUG] Application Minimise


> Hello Paul,
> Not sure what you mean but:
> You can put this in formcreate, or when the window state is to be
forced:
> Mainform.WindowState := WsMinimized;
>
>
>
> Wednesday, June 23, 2004, 9:03:32 AM, you wrote:
> PM> What is the best way to implement application minimise when a user
minimises a form ?
> PM>
> PM> Regards
> PM> Paul McKenzie
> PM> SMSS Ltd.
> PM> New Zealand.
>
>
>
>
> -- 
> Regards,
>  Alistair+
>
> _______________________________________________
> Delphi mailing list
> [EMAIL PROTECTED]
> http://ns3.123.co.nz/mailman/listinfo/delphi


_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

_______________________________________________
Delphi mailing list
[EMAIL PROTECTED]
http://ns3.123.co.nz/mailman/listinfo/delphi

Reply via email to