Hello,

I am opening a messagebox on top of a splash screen. The splash screen is a
normal windows form with(FormBorderStyle=None, StartPosition=Center and
TopMost=true).

My problem is that my MessageBox is clearing the splash form behind it. When
I press OK on the message box, the splash form is all gray(the background
color) and no controls are visible. I have tried to set up a timer on the
splash screen, and when the timer kicks in, the form is visible and it does
not help to call neither Update og invalidate on the form. The only thing
that helps is if I call Hide() and Show(), then all my controls are visible.

I call the messagebox with the owner window, but there is no difference.

Any ideas?

Thanks

Henrik.

Re: MessageBox clears my splash screen by Oliver

Oliver
Tue Oct 18 12:53:18 CDT 2005

Henrik Skak Pedersen wrote:

>I am opening a messagebox on top of a splash screen. The splash screen is
>a normal windows form with(FormBorderStyle=None, StartPosition=Center and
>TopMost=true).
>
>My problem is that my MessageBox is clearing the splash form behind it.
>When I press OK on the message box, the splash form is all gray(the
>background color) and no controls are visible. I have tried to set up a
>timer on the splash screen, and when the timer kicks in, the form is
>visible and it does not help to call neither Update og invalidate on the
>form. The only thing that helps is if I call Hide() and Show(), then all
>my controls are visible.
>
>I call the messagebox with the owner window, but there is no difference.

My guess is that you are hogging the UI thread, so the splash window is
never redrawn after it's been invalidated by the message box. Are you
showing the splash window on a separate thread? Or do you use a separate
thread for the other initialization work that's going on? If you show the
splash window on the same thread where you're doing other work, no redraw
can take place after the window has been shown initially.

The way I do this is to run an additional GUI thread for the splash
window. The advantage (compared to the more common approach of doing
initialization on an extra thread) is that the main application GUI thread
can be used to do initialization, so you can actually create forms and
controls and everything while still showing a nice fluent status animation
in the splash window.


Oliver Sturm
--
Expert programming and consulting services available
See http://www.sturmnet.org (try /blog as well)

Re: MessageBox clears my splash screen by Henrik

Henrik
Tue Oct 18 15:54:50 CDT 2005

Hi Oliver,

Thank you very much for your reply. That solved my problem.

Cheers

Henrik.

"Oliver Sturm" <oliver@sturmnet.org> wrote in message
news:xn0e8nauhhy5ug003@msnews.microsoft.com...
> Henrik Skak Pedersen wrote:
>
>>I am opening a messagebox on top of a splash screen. The splash screen is
>>a normal windows form with(FormBorderStyle=None, StartPosition=Center and
>>TopMost=true).
>>
>>My problem is that my MessageBox is clearing the splash form behind it.
>>When I press OK on the message box, the splash form is all gray(the
>>background color) and no controls are visible. I have tried to set up a
>>timer on the splash screen, and when the timer kicks in, the form is
>>visible and it does not help to call neither Update og invalidate on the
>>form. The only thing that helps is if I call Hide() and Show(), then all
>>my controls are visible.
>>
>>I call the messagebox with the owner window, but there is no difference.
>
> My guess is that you are hogging the UI thread, so the splash window is
> never redrawn after it's been invalidated by the message box. Are you
> showing the splash window on a separate thread? Or do you use a separate
> thread for the other initialization work that's going on? If you show the
> splash window on the same thread where you're doing other work, no redraw
> can take place after the window has been shown initially.
>
> The way I do this is to run an additional GUI thread for the splash
> window. The advantage (compared to the more common approach of doing
> initialization on an extra thread) is that the main application GUI thread
> can be used to do initialization, so you can actually create forms and
> controls and everything while still showing a nice fluent status animation
> in the splash window.
>
>
> Oliver Sturm
> --
> Expert programming and consulting services available
> See http://www.sturmnet.org (try /blog as well)