• Status: Solved
  • Priority: High
  • Security: Public
  • Views: 153
  • Last Modified:

C# Reflection on already running process

Hello All,

I have two C# WinForm applications. When BOTH apps are running, I would like to use reflection in App A to get and set information in App B. I can do this already if App A uses refelection to load the App B assembly. Is there anyway to do the same if App B is already running?

Also, when I use reflection in App A to Load the App B Assembly, is App B still running in its own process? I don't see it in task manager, but I do see it on the desktop

Both App A and App B are forms
Windows 7 Pro 64

Thanks very much,

2 Solutions
Nadir Van ThielenDHL Commented:
the way i do it is get the process memory address from the kernel32,
and get the info you need and r/w that address to the b app the same way but reversed.
Miguel OzSoftware EngineerCommented:
I do not think you can do this using reflection, you need to share information in a different way, some examples:
1. A file.
2.  A database table or tables.
3.  Inter process communication
4.  Web services (SOA, Web API)
Depending on your needs usually 1 and 2 will do the trick.
käµfm³d 👽Commented:
Agree with Miguel Oz, but I'd also add that perhaps the WinAPI could be used here as well...though it's more difficult to work with than the other suggestions.
Ultimate Tool Kit for Technology Solution Provider

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy now.

BrianDumasAuthor Commented:
Hello all, I am aware that I can use multiple number of ways to do IPC. What I needed in the beginning was a C# way of creating objects in App B. I have reflection working at this time that does just that, but it needs to 'start' App B for it to work. Just curious as to any method to do the same thing as I am doing now, without starting AppB (since in the actual environment App B will be running).

Miguel OzSoftware EngineerCommented:
As per my post, the answer you can not do it with reflection, you shall use one of the IPC based suggested solutions.
 "when I use reflection in App A to Load the App B Assembly, is App B still running in its own process?"
 No, APP B  is running in App A process, thus the reason you can access all their values in your current code, if it is a separate process then it is not possible
BrianDumasAuthor Commented:
Disagree with 'force accept', but not my decision.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now