Multiple Windows Forms Programs Interacting?
-
I am writing a program that consists of several applications, some are client applications, one is the master application, all are standard Windows Forms apps. The clients can all be started seperatly by the user, or the master application starts them automaticly to have the standard user interaction of the client programs and also automated interaction / control with the master program. I would like to do the interaction by simply using public methods and events. My question is now how do I start the client applications automaticly by the master to have this sort of access? Do I simply create a new instance of the clients main forms? Should I do this in seperate threads to avoid locking up the master program while the clients are working? Or do I have to somehow use Application.Run(), if so how do I do this? Are there any severe pitfalls I am missing? Help would be appreciated, Stephan
-
I am writing a program that consists of several applications, some are client applications, one is the master application, all are standard Windows Forms apps. The clients can all be started seperatly by the user, or the master application starts them automaticly to have the standard user interaction of the client programs and also automated interaction / control with the master program. I would like to do the interaction by simply using public methods and events. My question is now how do I start the client applications automaticly by the master to have this sort of access? Do I simply create a new instance of the clients main forms? Should I do this in seperate threads to avoid locking up the master program while the clients are working? Or do I have to somehow use Application.Run(), if so how do I do this? Are there any severe pitfalls I am missing? Help would be appreciated, Stephan
stephan.smolek wrote:
The clients can all be started seperatly by the user, or the master application starts them automaticly to have the standard user interaction of the client programs and also automated interaction / control with the master program.
The only way to start the other applications is by using the Process class to launch them.
stephan.smolek wrote:
also automated interaction / control with the master program
You cannot just expose public methods and expect to be able to call them acrossed AppDomain boundries. You're going to have to learn about .NET Remoting, or Windows Communication Foundation, and setup remoting servers and clients in your applications to handle the communication and you'll also have to carefully design your applications to expose their functionality through various object models, kind of like how Word and Excel do it.
A guide to posting questions on CodeProject[^]
Dave Kreskowiak Microsoft MVP Visual Developer - Visual Basic
2006, 2007