Zorder and splash screen

  • Thread starter Thread starter Andy
  • Start date Start date
A

Andy

Hi,

I have a form which is a splash screen. A static method is used by my
main program startup to show the form, which creates the form on a
seperate thread and shows it using Application.Run( splash ).

The problem is when my main form shows and the splash hides, the main
form ends up behind any other window display (such as my web browser or
explorer windows).

I've read this is because the first message pump that ends causes the
application to deactivate, but I haven't been able to find a solution
to this.

I had replaced Application.Run with this loop:

while ( !shouldClose ) {
Application.DoEvents();
}

Where should close is a boolean that indicates if the form should close
or not. (Which is set by another static method called from the main
thread).

Any ideas?
 
Andy said:
The problem is when my main form shows and the splash hides, the main
form ends up behind any other window display (such as my web browser or
explorer windows).

Try showing and activating the main form before hiding the splash page.
When the active window is hidden, the window manager finds a new window to
make active. If there are no eligible windows in your process then it will
pick one from another process.
 
hi,
Why don't you use this :

YourSplash frm = new YourSplash();
frm.Show();
Application.Run();

this way, everything runs as expected... as soon as their will be no other
loaded forms or process, the application will end... I just tested it and
it works real fine for your kind of situation...

I hope it helps...

ThunderMusic
 
oups, sorry, I must correct what I just said... you will have to manually
terminate the message pump with Application.Exit() when you want to close
your app definitly...

I hope it helps

ThunderMusic
 
Back
Top