?
Solved

VB.Net WinForms Application Main Form Loading with Splash Screen

Posted on 2015-01-27
3
Medium Priority
?
71 Views
Last Modified: 2016-07-12
I have a VB.NET WinForms application with a splash screen containing a progress bar which I can successfully update during the Load event of the Main Form (formMain).  This was accomplished by reviewing the following article:

http://www.experts-exchange.com/Programming/Languages/.NET/Visual_Basic.NET/A_3671-Updating-a-Splash-Screen-with-Loading-Progress-in-a-VB-Net-WinForms-Application.html

How can I determine what is occurring in my application prior to the formMain_Load() event being triggered?  The splash screen is visible and active for 15 seconds prior to reaching the breakpoint at the first line of the MyBase.Load event of formMain.  Afterwards, everything is as expected.  What is happening during this time prior to the main form getting loaded?  Any information is greatly appreciated.  Thank you for your time and help.

Christopher
0
Comment
Question by:chmarch
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 34

Assisted Solution

by:it_saige
it_saige earned 1000 total points
ID: 40573218
It really depends on your application and the framework used.  However in a nutshell. when your application is compiled, a PE executable is generated.  This PE application contains:
An entrypoint (usually Main).
A list of dependencies as dynamic libraries (which includes MSCOREE.DLL;  the .NET Common Object Runtime Execution Engine).
Additional metadata including the targeted .NET runtime version

When a user starts the application (by clicking on it, running it from a command line, etc.), the Windows loader implementation (in NTDLL.dll) takes over.  The loader code is responsible for putting the executable into memory, loading any dynamic link libraries, mapping any linked libraries into a place that the executable code can reach them and updating the Import Address Table.

Once this is all completed, the loader jumps to the defined entry point.  The entry point  goes to mscoreee.dll which was mapped into the processes memory.  MSCOREE.DLL looks at the metadata loaded from the PE executable (specifically the CLR header and targeted .NET runtime version).  From that it can bind the the correct CRL version using CorBindToRuntimeEx2.

CorBindToRuntimeEx2 loads the correct .NET runtime implementation (and returns a pointer to a COM interface allowing you to invoke that .NET runtime).  This code is loaded from the dlls in %WINDIR%\Microsoft.NET\Framework\{associated version number}

At this point, the MSCORREE shim uses the .NET ICLRRuntimeHost interface point to invoke the methods needed to initialize the .NET runtime, garbage collector, IL interpreter, JIT and IHostControl interfaces (that allow the .NET interpreter to talk back to the hosting process).  Finally, mscoree tells the IL interpreter to start executing your compiled application's IL code.Example of a comipled IL Manifest file (contains .NET runtime version, dependencies, resources and other metadata)Example IL Main entrypoint.The amazing thing is that all of the above, *usually*, happens in a matter of milliseconds.

The unfortunate thing, is that you cannot have a .NET Splash Screen for the above process as it is basically an unmanaged bootstrapper process and ultimately outside of the control of .NET.

-saige-
0
 
LVL 86

Accepted Solution

by:
Mike Tomlinson earned 1000 total points
ID: 40573250
Do a search for "Cold versus Warm Start of .Net" to get an idea of what you're dealing with.  Basically it is .Net itself that is loading and then any specific assemblies needed for your app.

Process Explorer: https://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
Improving Application Startup Time: https://msdn.microsoft.com/en-us/magazine/cc163655.aspx
Application Startup Time: https://msdn.microsoft.com/en-us/library/cc656914(v=vs.110).aspx
0

Featured Post

Want to be a Web Developer? Get Certified Today!

Enroll in the Certified Web Development Professional course package to learn HTML, Javascript, and PHP. Build a solid foundation to work toward your dream job!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month15 days, 6 hours left to enroll

741 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question