Shaofh

Shaofh

利用MessageQueue收发消息

           //Send
            MessageQueue MQueue = new MessageQueue(".\\private$\\MQDemo");
            System.Messaging.Message Msg = new System.Messaging.Message();
            Msg.Body = textBox1.Text;
            Msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(string) });
            MQueue .Send(Msg);
       
           //Receive         
           MessageQueue MQueue = new MessageQueue(".\\private$\\MQDemo");
           System.Messaging.Message Msg = MQueue.Receive();
           Msg.Formatter = new System.Messaging.XmlMessageFormatter(new Type[] { typeof(string) }); 
           MessageBox.Show(Msg.Body.ToString());

posted on 2007-08-30 15:57  sh37  阅读(638)  评论(0编辑  收藏  举报

导航