My application is experience an odd issue that makes it so it won't take focus when it starts up.

This is how it's setup:

My application first checks to see if any preferences have been created for the application. If they have not, it pops up a MessageBox to let the user know and ask where they want to create them. Once that's done, a second thread is created to display a splash screen.

Then, if the preferences were just created, my application uses a ShowDialog() on a form asking the user a question. When that's done, the second thread exists and the main form is launched form the main thread. This works great.

If the preferences were already created, that ShowDialog isn't called and eventually the Splash Screen thread exists and the main form is run from the main thread. When this happens, the main form does not have focus.

So it sounds like the second thread with the splash screen takes focus but when I call the showdialig from the main thread, it brings it back. In the case where it doesn't call the showdialog, it doesn't come back so how can I bring focus back to the main thread?