Click here to Skip to main content
15,886,017 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
I have 2 Windows Forms Applications with one form in each application.

now I want to open form1 in application2 from form1 in application1(I am trying with button click...)

What I have tried:

Created 2 Windows Forms Application
Posted
Updated 10-May-16 14:01pm
Comments
George Jonsson 10-May-16 19:11pm    
And what is the code behind button_click?
Bernhard Hiller 11-May-16 5:14am    
Repost of http://www.codeproject.com/Questions/1095581/How-to-open-a-window-on-remote-machine

1 solution

Don't. Processes are isolated and should remain isolated. It's possible to achieve on the base of Windows messages, but this approach is too Windows-specific, contradicts to more important principles of OS architecture is is generally so bad due to other reasons, so I don't even want to discuss them.

If you really need communication between different processes, you should use… well, communications, IPC, without touching any windows of a remote process. You send a request to another process to open a new window, in an abstract form, and the other process does it. But even this approach look quite questionable. You did not provide any justification. Why not have the applications united in one? Why not developing some plug-in architecture if you need such flexibility, still in one process? Why not using multithreading instead of two processes? And so on…

If you answer all this questions, they may reveal that your current architecture is the worst of all. Well… probably.

Now, if you still need the communications, it can be designed on many different levels, from sockets or named pipes to classic remoting to WCF. Please see my past answers:
Communication b/w two Windows applications on LAN.[^],
how i can send byte[] to other pc[^].

—SA
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900