ShadowHawk071998
asked on
BringToFront doesn't really work on forms...
Hi Guys.
I have a form that is acting as a timer. You put in on minimize, and after a few minutes it should pop back up. I want it to come on top of everything you have open, and display a message (Like Outlook reminders).
But I can't make my form on top of all other forms. I put the following lines -
WindowState := wsNormal ;
Show;
Application.BringToFront;
showmessage('Time to do XXX');
But none of these help. What am I missing?
T.
I have a form that is acting as a timer. You put in on minimize, and after a few minutes it should pop back up. I want it to come on top of everything you have open, and display a message (Like Outlook reminders).
But I can't make my form on top of all other forms. I put the following lines -
WindowState := wsNormal ;
Show;
Application.BringToFront;
showmessage('Time to do XXX');
But none of these help. What am I missing?
T.
this must work allways:
https://www.experts-exchange.com/questions/20553103/Application-BringToFront-Distribution.html
wbr, mo.
https://www.experts-exchange.com/questions/20553103/Application-BringToFront-Distribution.html
wbr, mo.
Cant you just set the formstyle to fsStayOnTop, so after you restore it, it'll come to the top on its own?
If you are using Windows 2000/XP, there is s.th. more specific. Take a look at :
https://www.experts-exchange.com/questions/20294536/WM-ACTIVATE.html
and
https://www.experts-exchange.com/questions/10223354/how-to-make-window-upmost-here.html
https://www.experts-exchange.com/questions/20294536/WM-ACTIVATE.html
and
https://www.experts-exchange.com/questions/10223354/how-to-make-window-upmost-here.html
Try this ....
if you use this the form will show aswell
- The SWP_SHOWWINDOW will display the window
SetWindowPos(form1.handle, hwnd_TopMo st,0,0,0,0 ,SWP_SHOWW INDOW);
- Places the window above all non-topmost windows.
The window maintains its topmost position even when
it is deactivated.
SetWindowPos(form1.handle, hwnd_NoTop Most,0,0,0 ,0,SWP_SHO WWINDOW);
- Places the window above all non-topmost windows (that
is, behind all topmost windows).
This flag has no effect if the window is already a non-
topmost window.
SetWindowPos(form1.handle, hwnd_Top,0 ,0,0,0,SWP _SHOWWINDO W);
- Places the window at the top of the Z order.
if you use this the form will show aswell
- The SWP_SHOWWINDOW will display the window
SetWindowPos(form1.handle,
- Places the window above all non-topmost windows.
The window maintains its topmost position even when
it is deactivated.
SetWindowPos(form1.handle,
- Places the window above all non-topmost windows (that
is, behind all topmost windows).
This flag has no effect if the window is already a non-
topmost window.
SetWindowPos(form1.handle,
- Places the window at the top of the Z order.
Try this ....
if you use this the form will show aswell
- The SWP_SHOWWINDOW will display the window
SetWindowPos(form1.handle, hwnd_TopMo st,0,0,0,0 ,SWP_SHOWW INDOW);
- Places the window above all non-topmost windows.
The window maintains its topmost position even when
it is deactivated.
SetWindowPos(form1.handle, hwnd_NoTop Most,0,0,0 ,0,SWP_SHO WWINDOW);
- Places the window above all non-topmost windows (that
is, behind all topmost windows).
This flag has no effect if the window is already a non-
topmost window.
SetWindowPos(form1.handle, hwnd_Top,0 ,0,0,0,SWP _SHOWWINDO W);
- Places the window at the top of the Z order.
if you use this the form will show aswell
- The SWP_SHOWWINDOW will display the window
SetWindowPos(form1.handle,
- Places the window above all non-topmost windows.
The window maintains its topmost position even when
it is deactivated.
SetWindowPos(form1.handle,
- Places the window above all non-topmost windows (that
is, behind all topmost windows).
This flag has no effect if the window is already a non-
topmost window.
SetWindowPos(form1.handle,
- Places the window at the top of the Z order.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I did not read the question throug :(.
SteveWaite's code will work the best.
Go Steve! :)
SteveWaite's code will work the best.
Go Steve! :)
SetWindowPos(): Left, Top, Width, 0 are of the main form, with height of zero you get (nearly) the proper animation when restoring.
Regards
Steve
Regards
Steve
ASKER
Hey guys.
None of these solution actually worked. Sorry. I guess it may come from the fact I need to display a message as well. I did find an elegant solution - I show my message as a modal window - this pops it on top, and I have the message displayed. Cool.
Will this work on Win95/98 as well? (I have win2K).
What should I do with the question?
None of these solution actually worked. Sorry. I guess it may come from the fact I need to display a message as well. I did find an elegant solution - I show my message as a modal window - this pops it on top, and I have the message displayed. Cool.
Will this work on Win95/98 as well? (I have win2K).
What should I do with the question?
Maybe it's from the fact you use ShowMessage()? If you use MessageBox() from the Windows API you can specify the parent handle. Don't quote me, but I think if you give a handle of 0, that uses the desktop and will make the dialog shown on top of all other windows.
ASKER
Actually the show modal is even preferable to teh MessageBox - it's more pretty.
But maybe I'll try that.
T.
But maybe I'll try that.
T.
Yes it will work the same in winX.
:)
:)
ShadowHawk:
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
This old question needs to be finalized -- accept an answer, split points, or get a refund. For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations! No comment means you don't care.
SetWindowPos(Handle,HWND_T