Home All Groups Group Topic Archive Search About

Detecting when VB.net 2005 splash screen closing or closed

Author
20 Jul 2006 10:11 PM
steve
Hi All

I have a form set as the splash screen in VB.net 2005 application properties

How can I tell when it has or is closing, as I want to then run some licence
checking code without the splash screen interfering with msgboxes which may
need to be displayed if the licence is invalid or missing

I have tried in the splash form's formclosing event but it does not fire

Regards
Steve

Author
20 Jul 2006 10:43 PM
Samuel Shulman
You can use the Load event (which will save time as it will run immediately)
then assign the results to a variable (shared or global etc.) then in  the
load event of the main form you can give user the info required

hth,
Samuel

Show quoteHide quote
"steve" <ga630sf@newsgroups.nospam> wrote in message
news:OAmeslErGHA.2180@TK2MSFTNGP05.phx.gbl...
> Hi All
>
> I have a form set as the splash screen in VB.net 2005 application
> properties
>
> How can I tell when it has or is closing, as I want to then run some
> licence checking code without the splash screen interfering with msgboxes
> which may need to be displayed if the licence is invalid or missing
>
> I have tried in the splash form's formclosing event but it does not fire
>
> Regards
> Steve
>
Author
21 Jul 2006 12:56 AM
Kevin Yu [MSFT]
Hi Steve,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to know whether a splash
screen has been closed during your program runs. If there is any
misunderstanding, please feel free to let me know.

In my opinion, setting a global flag is the simplest way to achieve this.
It can be a shared(static) variable, and when the splash screen closes,
assign a boolean value to that variable.

If anything is unclear, please feel free to reply to the post.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
21 Jul 2006 1:30 AM
steve
Hi Kevin

To set the global variable I need to set it in an event which fires when the
splash screen closes

I cannot find an event that fires when it closes

formclosing doesn't fire

Note The splash form is set as the Applications splash screen and I don't
know if this makes a difference

All my other forms in my APP fire the formclosing event when closing

Regards
Steve


Show quoteHide quote
"Kevin Yu [MSFT]" <v-k***@online.microsoft.com> wrote in message
news:UaM6%23BGrGHA.1572@TK2MSFTNGXA01.phx.gbl...
> Hi Steve,
>
> First of all, I would like to confirm my understanding of your issue. From
> your description, I understand that you need to know whether a splash
> screen has been closed during your program runs. If there is any
> misunderstanding, please feel free to let me know.
>
> In my opinion, setting a global flag is the simplest way to achieve this.
> It can be a shared(static) variable, and when the splash screen closes,
> assign a boolean value to that variable.
>
> If anything is unclear, please feel free to reply to the post.
>
> Kevin Yu
> Microsoft Online Community Support
>
> ==================================================
> Get notification to my posts through email? Please refer to
> http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
> ications.
> Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
> where an initial response from the community or a Microsoft Support
> Engineer within 1 business day is acceptable. Please note that each follow
> up response may take approximately 2 business days as the support
> professional working with you may need further investigation to reach the
> most efficient resolution. The offering is not appropriate for situations
> that require urgent, real-time or phone-based interactions or complex
> project analysis and dump analysis issues. Issues of this nature are best
> handled working with a dedicated Microsoft Support Engineer by contacting
> Microsoft Customer Support Services (CSS) at
> http://msdn.microsoft.com/subscriptions/support/default.aspx.
> ==================================================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
21 Jul 2006 3:37 AM
gene kelley
Show quote Hide quote
On Fri, 21 Jul 2006 11:30:37 +1000, "steve" <ga630sf@newsgroups.nospam> wrote:

>Hi Kevin
>
>To set the global variable I need to set it in an event which fires when the
>splash screen closes
>
>I cannot find an event that fires when it closes
>
>formclosing doesn't fire
>
>Note The splash form is set as the Applications splash screen and I don't
>know if this makes a difference
>
>All my other forms in my APP fire the formclosing event when closing
>
>Regards
>Steve
>
>
The problem with the Splash Screen that you describe is a known issue.  There are a couple of
workarounds that I have found that work depending on what effect you want:

1) Display Splash Screen, check for prerequisits, notify user and exit if prerequisit not met:

       Private Sub MyApplication_Startup(ByVal sender As Object, ByVal e _
            As Microsoft.VisualBasic.ApplicationServices.StartupEventArgs) Handles Me.Startup

            If NoLicense() Then
                 'Ensure the Splash Screen has been created and displayed 
    If Not Me.SplashScreen Is Nothing Then
                    While Not Me.SplashScreen.IsHandleCreated
                        System.Threading.Thread.Sleep(100)
                    End While
                    'Hide the SplashForm so that the message box can been seen
          Me.HideSplashScreen()
                End If

                MessageBox.Show("License Not Found", "My Application", MessageBoxButtons.OK, _
                    MessageBoxIcon.Stop)
                 'Bail out
       e.Cancel = True
            End If

      End Sub

2) Check prerequisits before the Splash Screen is displayed.  If prerequisits not met, simply bail
out, else the Splash Form will display and app will continue to load:
    Public Sub New() 'in SplashForm

        If NoLicense() Then
            MessageBox.Show("License Not Found", "My Application", MessageBoxButtons.OK, _
                        MessageBoxIcon.Stop)
            End
        End If
        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call.

    End Sub


Gene
Author
24 Jul 2006 9:04 AM
Kevin Yu [MSFT]
Hi Steve,

Yes, it's true. I checked internally, like Gene said, it is a known issue.
Gene has provided us with a good workaround. Please let me know if you have
any concern.

Kevin Yu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.
Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)