C#之消息队列的简要说明----自学笔记[1]

[入库:2005年8月18日] [更新:2007年3月24日]

本文简介:选择自 dhz123 的 blog

using system;
using system.drawing;
using system.collections;
using system.componentmodel;
using system.windows.forms;
using system.data;
using system.messaging ;
using system.threading ;

namespace winmsmq
{
 /// <summary>
 /// form1 的摘要说明。
 /// </summary>
 public class form1 : system.windows.forms.form
 {
  static manualresetevent signal = new manualresetevent(false);
  static manualresetevent  pubrecviesignal=new manualresetevent(false);
  private system.messaging.messagequeue mq=null;
  private readonly  string  qryname=@"";
  private  messagequeue msq=null;
  private  messagequeue pubmsq=null;
  private system.windows.forms.button button1;
  private system.windows.forms.button button2;
  private system.windows.forms.button button3;
  private system.windows.forms.richtextbox richtextbox1;
  private system.windows.forms.groupbox groupbox1;
  private system.windows.forms.groupbox groupbox2;
  private system.windows.forms.button button5;
  private system.windows.forms.button button6;
  private system.windows.forms.button button7;
  private system.windows.forms.groupbox groupbox3;
  private system.windows.forms.button sendtopub;
  private system.windows.forms.button readfrompub;
  private system.windows.forms.button creaet;
  private system.windows.forms.button button4;
  private system.windows.forms.button delpubmsg;
  private system.windows.forms.button srpub;
  private system.data.sqlclient.sqlconnection sqlconnection1;
  /// <summary>
  /// 必需的设计器变量。
  /// </summary>
  private system.componentmodel.container components = null;
  public form1()
  {
   //
   // windows 窗体设计器支持所必需的
   //
   initializecomponent();
   this.qryname=system.configuration.configurationsettings.appsettings["pubmsmqqryname"];
   if(messagequeue.exists(qryname))
   {
    this.pubmsq=new messagequeue(qryname,true);
   }
   else
   {
    this.pubmsq=system.messaging.messagequeue.create(qryname,true);
   }
   this.richtextbox1.appendtext("==================\r\n");
   this.richtextbox1.appendtext(this.pubmsq .queuename +":公共队列创建成功!\r\n");

   //
   // todo: 在 initializecomponent 调用后添加任何构造函数代码
   //
  }
  /// <summary>
  /// 清理所有正在使用的资源。
  /// </summary>
  protected override void dispose( bool disposing )
  {
   if( disposing )
   {
    if (components != null)
    {
     components.dispose();
    }
   }
   base.dispose( disposing );
  }

  #region windows 窗体设计器生成的代码
  /// <summary>
  /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  /// 此方法的内容。
  /// </summary>
  private void initializecomponent()
  {
   this.button1 = new system.windows.forms.button();
   this.button2 = new system.windows.forms.button();
   this.button3 = new system.windows.forms.button();
   this.richtextbox1 = new system.windows.forms.richtextbox();
   this.groupbox1 = new system.windows.forms.groupbox();
   this.groupbox2 = new system.windows.forms.groupbox();
   this.button4 = new system.windows.forms.button();
   this.button7 = new system.windows.forms.button();
   this.creaet = new system.windows.forms.button();
   this.button6 = new system.windows.forms.button();
   this.button5 = new system.windows.forms.button();
   this.groupbox3 = new system.windows.forms.groupbox();
   this.srpub = new system.windows.forms.button();
   this.delpubmsg = new system.windows.forms.button();
   this.readfrompub = new system.windows.forms.button();
   this.sendtopub = new system.windows.forms.button();
   this.sqlconnection1 = new system.data.sqlclient.sqlconnection();

本文关键:C#之消息队列的简要说明----自学笔记
  相关方案
Google
 

本站最佳浏览方式为 分辨率 1024x768 IE 6.0(或更高版本的 IE浏览器)

go top