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,

Brian DumasSenior Software EngineerAsked:
Who is Participating?
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.

Nadir Van ThielenCommented:
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.

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
Miguel OzSenior Software 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.
kaufmed   ( ⚆ _ ⚆ )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.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Brian DumasSenior Software EngineerAuthor 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 OzSenior Software 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
Brian DumasSenior Software EngineerAuthor Commented:
Disagree with 'force accept', but not my decision.
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

From novice to tech pro — start learning today.