Re: Access a running process
Well, multithreading is not the same as multiprocessing.
You cannot directly access "some public variable" of one process from another process. You have to implement some type of IPC (Interprocess Communications) between them.
I'm not a expert in C#, so may be wrong, but look at these .NET functions.
Re: Access a running process
Does the process P2 "belong" to you?
Do you have access to its source code?
If yes, then it's easy to implement some kind of IPC.
If not, then you could still get access to P2's memory address space using WinAPI, this is what typical game hacks do.
________________________________
Visit my project: Derivative Calculator
Re: Access a running process
Quote:
I want to access some public variable of P1 from P2
Please define "public." What publishing mechanism is implied here?
Quote:
firstly, i have to suspend P1 until P2 completes
Suspending process isn't anything trivial, and there's no standard mechanism for this I'm aware of.
Quote:
I want to access some public variable of P1 from P2
. . .
secondly, i should make sure that P2 does not create a new instance of P1.
I believe that's something wrong with the explanation. :) From "I want to access" I get that P2 is all yours. So to make sure P2 does not create something you should not create that something. ;)