使用windows消息服务可以做到这一点。

解决方案 »

  1.   

    我做了一个出来,你看看。
    例如:程序A要发给程序B一个消息。
    假定程序B的名称叫Form1;
    在程序A中加入:
    using System.Runtime.InteropServices;
    然后加入下面代码
    // Import the SendMessage method of the User32 DLL.   
    [DllImport("user32.dll", CharSet=CharSet.Auto)]
    public static extern IntPtr SendMessage(IntPtr hWnd, int msg, int wParam, int lParam);
    [DllImport("user32.dll")]
    public static extern IntPtr FindWindow(string lpClassName,string lpWindowName); private void button1_Click(object sender, System.EventArgs e)
    { IntPtr hWnd= FindWindow(null,"Form1");
    SendMessage(hWnd,123,0,0); }、、、、
    在程序B中(名字叫“Form1”);
    重载WndProc方法,加入以下代码:
    protected override void WndProc( ref Message m )

    switch(m.Msg) 

    case 123:  
    MessageBox.Show("我收到了123!"); 
    break; 
    }  
    base.WndProc(ref m );
    }运行即可。
      

  2.   

    MSMQ 或者是
    volatile 关键字指示字段可由操作系统、硬件或并发执行的线程在程序中进行修改。系统总是在 volatile 对象被请求的那一刻读取其当前值,即使上一条指令从同一对象请求值。而且,该对象的值在赋值时立即写入。
      

  3.   

    to:chainet(学习创业)
       算数,可我需要的是用消息发送字符串呀!