Now that the splash screen is displayed, we need to launch the actual WPF application. This part is fairly straightforward: we just need to build the path to the executable file, then call CreateProcess to execute it.
This method returns a handle to the launched process; we will use this in the next installment to quit the splash screen application if the WPF application exits early (presumably due to an unexpected failure). I’ll also show how to create an event that the WPF application can use to signal to the splash screen application that the WPF UI has been displayed and that the splash screen should be closed.
The CreateProcess documentation says that the handles in the
PROCESS_INFORMATION structure must be closed when they are no longer needed,
PROCESS_INFORMATION documentation lets us know that they will
automatically be closed when the splash screen process exits; thus, there is
no need to specially track the thread handle just so that it can be closed.
Posted by Bradley Grainger on September 26, 2008