Many thanks Vladimir. That solved my task. Great!!! However, I have one more related problem left:
My application may create several child forms in runtime. I want to make them topmost too. Setting WndParent:=0 displays a button for the child form which I don't want. Making the child form a ToolWindow causes a thinner caption bar which I don't want neither. By setting WndParent:=MainForm.Handle I can almost make it work, but the child forms do not minimize when the mainform is minimized. Is there any simple solution to this or do I have to iterate through the child windows in the WMSysCommand message handler and use ShowWindow() in a similar way as for the mainForm? BR, Lars --- In [email protected], "Vladimir Yushko" <[EMAIL PROTECTED]> wrote: > > 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" <yahoo@> > > 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 > > > > > > > > > > >

