C# Application to Launch and Monitor a VB6 Application

I have an old application written in Visual Basic 6. We'd love nothing more than to retire it but can't yet. So, I'm trying to build a C# program that will launch and monitor the VB 6 application. Getting the application to launch and check for its exit state is trivial. The entire application is here:
	static class Program
	{
		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main()
		{
			Process remoteProcess = Process.Start(@"C:\Program Files (x86)\Test\MyProgram.exe", "user1");
			remoteProcess.EnableRaisingEvents = true;
			remoteProcess.Exited += RemoteProcess_Exited;
			remoteProcess.WaitForExit();
		}

		private static void RemoteProcess_Exited(object sender, EventArgs e)
		{
			Process remoteProcess = sender as Process;
			if (remoteProcess.ExitCode != 0)
			{
				MessageBox.Show($"The program terminated abnormally (exit code {remoteProcess.ExitCode})");
			}
		}
	}

Open in new window

This works just fine for what it does. However, I'd like to be able to monitor the application for more details like when the user opens another form from within the application. It's an old MDI application and I know the VB6 form class is something like ThunderRT6Form. I'm guessing I'll have to get into some lower level Windows hooks to make this work but I don't really know where I should start. Anyone have any ideas?
LVL 22
Russ SuterSenior Software DeveloperAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Ares KurkluSoftware EngineerCommented:
One way I can think of would be to get VB to create some sort of file in a folder indicating that a specific form is open, even some sort of log file
but then I suppose you may not want to read all the logs.
You can simply create a file and  if the user closes the form you may have to remove the file.
Then you can monitor from the C# program that folder and look for those files.
Russ SuterSenior Software DeveloperAuthor Commented:
I've already considered that. There are literally hundreds of forms in the VB6 application and I'd have to alter the code on every single one of them to implement something like that. It's just not practical. I'm looking for a clever solution here.
Ares KurkluSoftware EngineerCommented:
Sorry can't really think of any other way of both programs interacting especially when one is such an outdated technology like VB6, I guess this may be your best shot.
Russ SuterSenior Software DeveloperAuthor Commented:

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Russ SuterSenior Software DeveloperAuthor Commented:
No alternatives provided and this worked.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.