Please be gentle with me - I'm early on in a steep learning curve! I have inherited an application which I have to maintain - I'm using .NET 2.0 and VS2005 Professional (and C++, but I hope the same principles apply as with C#).
I have a fairly simple application, which is based around one form. However, it also has an optional registration dialog to display first, and a splash screen.
The code I have is almost certainly very wrong - my 'main' function looks something like:
Form ^ dialogRegistration = gcnew registration();
dialogRegistration->ShowDialog();
}
Application::Run(gcnew SplashScreen());
Application::Run(gcnew MainAppForm());
.
.
.
See what I mean? Not only does this app contain *two* Application::Runs, but it also first displays a dialog before the first Application::Run - so presumably before there's a message pump etc set up at all?
Strangely, this application does work - it's sold numerous copies to the paying public. I've had very occasional reports of errors at startup, which is what's caused me to look at this in the first place. But 99% of times, including on all my systems here, it works fine.
My questions are - is the code above as broken as I think? And can anyone guide me as to how I should be doing it? The functionality needs to remain:
1 (optionally) do a form A (the registration form). Then...
2 do splash screen. Then...
3 do form B (the application's main form).
Thanks in advance for any help.
Tom