开发者

Change a variable contained in one process from a different process

(probably a dumb question)

// Program_1.exe:
int num = 1;
using (Process process = new Process())
{
  process.StartInfo.FileName = "Program_2.exe";
  if (process.Start())
  {
    process.WaitForExit();
  }
}
Console.WriteLine(开发者_JS百科num.ToString()); // num should now equal 2

Psuedocode

// Program_2.exe:
// I want this program to change the value of a variable in Program_1.exe
Program_1.exe->num = 2;

Is this possible?

If so, how can I do it?


You need to use some form of inter-process communication, such as WCF.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜