Detecting when VB.net 2005 splash screen closing or closed

S

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
 
S

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
 
K

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.)
 
S

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
 
G

gene kelley

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
 
K

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top