Hi,
You should override following methods:

    procedure WMSysCommand(var Message: TWMSysCommand); message
WM_SYSCOMMAND;

procedure TTaskForm.WMSysCommand(var Message: TWMSysCommand);
begin
  case (Message.cmdtype and $FFF0) of
    SC_MINIMIZE:
      begin
        ShowWindow(handle, SW_MINIMIZE);
        Message.result := 0;
      end;
    SC_RESTORE:
      begin
        ShowWindow(handle, SW_RESTORE);
        Message.result := 0;
      end;
  else
    inherited;
  end;
end;

procedure TTaskForm.CreateParams(var Params: TCreateParams);
begin
  inherited CreateParams(Params);
  //Show a button for the main form
  with Params do begin
    ExStyle := ExStyle or WS_EX_APPWINDOW and not WS_EX_TOOLWINDOW;
    WndParent := 0;
  end;
end;

procedure TTaskForm.DoClose(var Action: TCloseAction);
begin
  inherited;
  Action := caFree;
end;

--
Vladimir Yushko
http://yarrowsoft.com/  solutions for Outlook Express

----- Original Message -----
From: "lars_stahre" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Tuesday, September 25, 2007 1:37 AM
Subject: [delphi-en] Re: How can I make a form globally "topmost" without
having a taskbar button


> Hello my friends and thank you for your quick suggestions.
> My appologize for responding slowly. -I have been unavailable for
> some while.
>
> Vladimir - Your suggestions definitely makes the window topmost if I
> also set the desktop as the window owner (instead of the application).
> However, when I hide the extra button the button that is left still
> does not work properly. The maximize and minimize choices doesn't
> work.
> Does anyone know how to correct this?
>
> BR,
> Lars
>
>
>
> --- In [email protected], "Vladimir Yushko" <[EMAIL PROTECTED]>
> wrote:
> >
> >  Hi!
> > First hide the button created by Delphi for the Application:
> >
> >   ShowWindow(Application.Handle, SW_HIDE);
> >   SetWindowLong(Application.Handle, GWL_EXSTYLE,
> >     GetWindowLong(Application.Handle, GWL_EXSTYLE) or
> >     WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
> >   ShowWindow(Application.Handle, SW_SHOW);
> >
> > --
> > Vladimir Yushko
> > http://yarrowsoft.com/
> >
> > ---
> >
>
>
>
>
> -----------------------------------------------------
> Home page: http://groups.yahoo.com/group/delphi-en/
> To unsubscribe: [EMAIL PROTECTED]
> Yahoo! Groups Links
>
>
>
>
>

Reply via email to