Wince环境下实现收发消息队列
来源:互联网 发布:ios 淘宝首页实现技术 编辑:程序博客网 时间:2024/05/17 06:30
Wince环境下没有安装msmq组件,需要单独下载安装。
下载 Optional Windows Mobile 5.0 Server Components.exe 后在目录Optional Windows Mobile 5.0 Server Components/Optional Windows Mobile 5.0 Server Components/msmq下可得到msmq.arm.CAB
安装msmq.arm.CAB 要用到VisAdm.exe工具
VisAdm.exe工具在另一个开发包中,可以从微软下载。
使用VisAdm.exe时点击Shortcuts
进入下一个界面
点击 :Install (成功则不信息)
点击: Register (会显示 GUID 如果存在会提示)
重启后在点击 Verify
现在可以收发消息队列了
string path = @"FormatName:DIRECT=OS:yuxianye/private$/yu";
private void button1_Click(object sender, EventArgs e)
{
//System.Messaging.MessageQueue mq = new System.Messaging.MessageQueue(@"china-8d5578550/private$/yu");
try
{
MessageQueue myQueue = new MessageQueue(path);
myQueue.Send(this.textBox1.Text);
myQueue.Close();
label1.Text ="发送成功";
}
catch (System.Messaging.MessageQueueException ex)
{
label1.Text = ex.Message;
}
}
private void button2_Click(object sender, EventArgs e)
{
MessageQueue myQueue = new MessageQueue(path);
((XmlMessageFormatter)myQueue.Formatter).TargetTypes = new Type[] { typeof(string) };
try
{
Message myMessage = myQueue.Receive(new TimeSpan(0));
textBox2.Text = myMessage.Body.ToString () ;
label1.Text = "接收成功";
}
catch (MessageQueueException ex)
{
label1.Text = ex.Message;
}
finally
{
myQueue.Close();
}
}
private void Form1_Load(object sender, EventArgs e)
{
//if (!MessageQueue.Exists(path))
// MessageQueue.Create(path);
}
以上实现在本机上收发,如果要给远程的服务器发,还要设置其他项。
- Wince环境下实现收发消息队列
- WinCE下消息队列用法
- WINCE下消息传递和消息队列
- Linux下 用消息队列收发长度不同的消息
- WinCE下消息队列用法MsgQueue
- 在WINCE下的点对点消息队列
- 在WINCE下的点对点消息队列
- WINCE下消息队列的简单用法----MsgQueue
- UNIX环境下如何应用消息队列实现进程间通信
- UNIX环境下如何应用消息队列实现进程间通信
- 如何在.NET环境下实现收发邮件
- C#实现消息的收发
- linux 下内核中消息队列实现
- 关于vxWorks下消息队列的实现
- PHP下用Memcache 实现消息队列
- linux环境消息队列
- . Net环境下消息队列(MSMQ)对象的应用
- . Net环境下消息队列(MSMQ)对象的应用
- 一篇介绍Nevow的非常好的文章,推荐
- 解析.net中ref和out的实质(高手勿进)
- ASP.NET 清除 HTML 标记函数
- 文件上传Fileupload(无刷新页面)
- 希望新的开始
- Wince环境下实现收发消息队列
- 在Closing事件中取消窗体关闭
- ORA-12545:因目标主机或对象不存在解决方法
- 异常处理
- UML 设计
- javascript对象坐标控制属性(包括offsetTop,offsetLeft等属性)
- 抓重点
- 使用annotation开发hibernate3程序
- 发现校内网好友买卖的一个小漏洞!并成功实现自动好友买卖!