 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Simon Guertin Guest
|
Posted: Mon Jun 27, 2005 2:35 pm Post subject: Display a TForm on top of other windows |
|
|
Hi, I am trying to force a Form to be displayed on top of other windows.
It works when the form is not displayed on screen but it does not work
when the form is already displayed and partially and/or completely
hidden under another window.
Application->Restore();
Application->BringToFront();
MyForm->Show();
MyForm->BringToFront();
SetForegroundWindow( MyForm->Handle ));
BringWindowToTop( MyForm->Handle ));
is there a correct combination or a right order that will make my form
show up on top of all other windows?
My application also is controlled via another application that sends a
message through a named pipe, that is why my application does not have
the focus.
Thanks
Simon
|
|
| Back to top |
|
 |
Vladimir Stefanovic Guest
|
Posted: Mon Jun 27, 2005 4:07 pm Post subject: Re: Display a TForm on top of other windows |
|
|
Try this /but not sure if that will help/:
// This line (in my case) has effect only on Win98
SetForegroundWindow( Handle );
// This combination I use in similar cases ...
Application->Restore();
Application->BringToFront();
// This is something like FormStyle::fsStayOnTop which Borland claims...
// ... that is not advisable to do at run-time (changing Form Style),
// but this API solution does not affect your code stability in any way
(AFAIK)
SetWindowPos( Handle, HWND_TOPMOST, Left, Top, Width, Height,
SWP_NOSIZE );
--
Best regards,
Vladimir Stefanovic
|
|
| Back to top |
|
 |
Simon Guertin Guest
|
Posted: Tue Jun 28, 2005 2:45 pm Post subject: Re: Display a TForm on top of other windows |
|
|
I tried the SetWindowPos way and only work to show the window on top of
every other window, but then , the window stays on top until I click it,
this is not what I want, is there a bug or an error in the Borland
implemantation to make a window on top?
I tried and I tried many many other ways to bring a window that is
already visible but is hidden by other window that are on top of the
window and nothing works.
The Bring ToTop is not able to bring the window on top neitheir
BringWindowToFront.
I was able to bring the window to the front using CWnd->BringToFront
from another application (Using FindWindow("MYWINDOWNAME"))but again the
Form's behavior was not working properly when I used this way to display
my form.
Simon
Vladimir Stefanovic wrote:
| Quote: | Try this /but not sure if that will help/:
// This line (in my case) has effect only on Win98
SetForegroundWindow( Handle );
// This combination I use in similar cases ...
Application->Restore();
Application->BringToFront();
// This is something like FormStyle::fsStayOnTop which Borland claims...
// ... that is not advisable to do at run-time (changing Form Style),
// but this API solution does not affect your code stability in any way
(AFAIK)
SetWindowPos( Handle, HWND_TOPMOST, Left, Top, Width, Height,
SWP_NOSIZE );
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|