Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Splash window
Message
General information
Forum:
ASP.NET
Category:
Other
Title:
Miscellaneous
Thread ID:
00795786
Message ID:
00795943
Views:
15
>How can i implement a splash window?

What I usually do if I have a complex application is spin up a new thread in my startup class and have it show the Splash screen, then continue on the main thread to load the main form.

However, I think you will find even with this approach that most of the slowness is in the EXE starting up not the actual form loading so that unless the main form is very complex you will see the splash pop up only a little bit before the main app does...

the code to do this is something like this:
public static void RunSplash() 
{
	Splash loSplash =  new Splash(true); // Splash screen flag otherwise it just displays  and doesn't unload
	loSplash.Visible = true;
	loSplash.TopMost = true;
	Application.Run( loSplash );
}

[STAThread]
static void Main(string[] args) 
{
	// *** Get the startup path and make sure Web Monitor is running out of it
	Environment.CurrentDirectory = wwUtils.GetAppStartPath(null);

				
		// *** First the splash screen on top on a separate thread
		ThreadStart delSplash = new ThreadStart(Startup.RunSplash);
		Thread NewThread = new Thread(delSplash);
		NewThread.Name = "Splash";
		NewThread.Start();

		// *** Run the main form on the main thread
		WebMonitorMain loForm = new WebMonitorMain();
		loForm.Show();
		loForm.Activate(); // make sure this form becomes active behind splash

		Application.Run();
The Splash form then has a timer on it that fires after x seconds and calls Application.ExitThread() which causes the splash thread to die and release the window.

+++ Rick ---
+++ Rick ---

West Wind Technologies
Maui, Hawaii

west-wind.com/
West Wind Message Board
Rick's Web Log
Markdown Monster
---
Making waves on the Web

Where do you want to surf today?
Previous
Reply
Map
View

Click here to load this message in the networking platform