Board index » delphi » Minimizing non-main-forms!

Minimizing non-main-forms!

In my application, the main-form is a tiny window with almost no
controls at all. This form creates another form where all the
interaction is..
My problem is when I try to minimize the second form, it wont disappear
to the traybar. It stays visible on the desktop in the lower left
corner..

Help me! How can I tell if my form is about to be minimized (so I can do
a Application.Minimize, and the form will disappear)??

Jan-

 

Re:Minimizing non-main-forms!


Quote
In article <365A8F19.342B9...@online.no>, Jan Christensen wrote:
> Help me! How can I tell if my form is about to be minimized (so I can do
> a Application.Minimize, and the form will disappear)??

Add a handler for the WM_SYSCOMMAND message:

  private // form declaration
    Procedure WMSyscommand(Var msg: TWmSysCommand);
      message WM_SYSCOMMAND;

Procedure TForm1.WMSyscommand(Var msg: TWmSysCommand);
  Begin
    Case (msg.cmdtype and $FFF0) of
      SC_MINIMIZE: Begin
          Application.Minimize;
          msg.result := 0;
        End;  
      Else
        inherited;
    End;
  End;

Peter Below (TeamB)  100113.1...@compuserve.com)
No e-mail responses, please, unless explicitely requested!

Re:Minimizing non-main-forms!


Quote
Jan Christensen wrote:

> In my application, the main-form is a tiny window with almost no
> controls at all. This form creates another form where all the
> interaction is..
> My problem is when I try to minimize the second form, it wont disappear
> to the traybar. It stays visible on the desktop in the lower left
> corner..

You can make secondary forms minimize to the taskbar by overriding
CreateParams and adding the WS_EX_APPWINDOW style to Params.ExStyle. If
you want the secondary form to stay on the screen when the program is
minimized, set Params.WndParent to the result of the GetDesktopWindow
API function.

Harold Howe [TeamB]
http://www.bcbdev.com

Other Threads