次の方法で共有


MessageQueue コンストラクター

定義

MessageQueue クラスの新しいインスタンスを初期化します。

オーバーロード

MessageQueue()

MessageQueue クラスの新しいインスタンスを初期化します。 パラメーターなしのコンストラクターが新しいインスタンスを初期化した後、インスタンスを使用する前に、インスタンスの Path プロパティを設定する必要があります。

MessageQueue(String)

指定したパスにあるメッセージ キュー キューを参照する MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, Boolean)

指定したパスにあるメッセージ キュー キューを参照し、指定した読み取りアクセス制限を使用して、MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, Boolean, Boolean)

MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue(String, Boolean, Boolean, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

MessageQueue()

MessageQueue クラスの新しいインスタンスを初期化します。 パラメーターなしのコンストラクターが新しいインスタンスを初期化した後、インスタンスを使用する前に、インスタンスの Path プロパティを設定する必要があります。

public:
 MessageQueue();
public MessageQueue ();
Public Sub New ()

次のコード例では、新しい MessageQueueを作成します。

// Connect to a queue on the local computer. You must set the queue's
// Path property before you can use the queue.
MessageQueue queue = new MessageQueue();
queue.Path = ".\\exampleQueue";

注釈

このオーバーロードを使用して、メッセージ キュー サーバー上のキューにすぐに関連付けられていない MessageQueue クラスの新しいインスタンスを作成します。 このインスタンスを使用する前に、Path プロパティを設定して既存のメッセージ キュー キューに接続する必要があります。 または、MessageQueue 参照を Create(String) メソッドの戻り値に設定して、新しいメッセージ キュー キューを作成することもできます。

MessageQueue コンストラクターは、MessageQueue クラスの新しいインスタンスをインスタンス化します。新しいメッセージ キュー キューは作成されません。

次の表に、MessageQueueのインスタンスの初期プロパティ値を示します。

財産 初期値
DefaultPropertiesToSend DefaultPropertiesToSend クラスのパラメーターなしのコンストラクターによって設定される値。
Formatter XmlMessageFormatter
MessageReadPropertyFilter MessagePropertyFilter クラスのパラメーターなしのコンストラクターによって設定される値。 すべてのフィルター値は trueに設定されます。
DenySharedReceive false

こちらもご覧ください

適用対象

MessageQueue(String)

指定したパスにあるメッセージ キュー キューを参照する MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path);
public MessageQueue (string path);
new System.Messaging.MessageQueue : string -> System.Messaging.MessageQueue
Public Sub New (path As String)

パラメーター

path
String

この MessageQueueによって参照されるキューの場所。

例外

Path プロパティが無効です。これは、設定されていない可能性があります。

次のコード例では、さまざまなパス名構文の種類を使用して新しい MessageQueue オブジェクトを作成します。 いずれの場合も、コンストラクターでパスが定義されているキューにメッセージを送信します。

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
ref class MyNewQueue
{
public:

   // References public queues.
   void SendPublic()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue" );
      myQueue->Send( "Public queue by path name." );
      return;
   }


   // References private queues.
   void SendPrivate()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( ".\\Private$\\myQueue" );
      myQueue->Send( "Private queue by path name." );
      return;
   }


   // References queues by label.
   void SendByLabel()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( "Label:TheLabel" );
      myQueue->Send( "Queue by label." );
      return;
   }


   // References queues by format name.
   void SendByFormatName()
   {
      MessageQueue^ myQueue = gcnew MessageQueue( "FormatName:Public=5A5F7535-AE9A-41d4 -935C-845C2AFF7112" );
      myQueue->Send( "Queue by format name." );
      return;
   }


   // References computer journal queues.
   void MonitorComputerJournal()
   {
      MessageQueue^ computerJournal = gcnew MessageQueue( ".\\Journal$" );
      while ( true )
      {
         Message^ journalMessage = computerJournal->Receive();
         
         // Process the journal message.
      }
   }


   // References queue journal queues.
   void MonitorQueueJournal()
   {
      MessageQueue^ queueJournal = gcnew MessageQueue( ".\\myQueue\\Journal$" );
      while ( true )
      {
         Message^ journalMessage = queueJournal->Receive();
         
         // Process the journal message.
      }
   }


   // References dead-letter queues.
   void MonitorDeadLetter()
   {
      MessageQueue^ deadLetter = gcnew MessageQueue( ".\\DeadLetter$" );
      while ( true )
      {
         Message^ deadMessage = deadLetter->Receive();
         
         // Process the dead-letter message.
      }
   }


   // References transactional dead-letter queues.
   void MonitorTransactionalDeadLetter()
   {
      MessageQueue^ TxDeadLetter = gcnew MessageQueue( ".\\XactDeadLetter$" );
      while ( true )
      {
         Message^ txDeadLetter = TxDeadLetter->Receive();
         
         // Process the transactional dead-letter message.
      }
   }

};


//*************************************************
// Provides an entry point into the application.
//         
// This example demonstrates several ways to set
// a queue's path.
//*************************************************
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   myNewQueue->SendPublic();
   myNewQueue->SendPrivate();
   myNewQueue->SendByLabel();
   myNewQueue->SendByFormatName();
   myNewQueue->MonitorComputerJournal();
   myNewQueue->MonitorQueueJournal();
   myNewQueue->MonitorDeadLetter();
   myNewQueue->MonitorTransactionalDeadLetter();
   return 0;
}
using System;
using System.Messaging;

namespace MyProject
{
    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {

        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example demonstrates several ways to set
        // a queue's path.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            myNewQueue.SendPublic();
            myNewQueue.SendPrivate();
            myNewQueue.SendByLabel();
            myNewQueue.SendByFormatName();
            myNewQueue.MonitorComputerJournal();
            myNewQueue.MonitorQueueJournal();
            myNewQueue.MonitorDeadLetter();
            myNewQueue.MonitorTransactionalDeadLetter();

            return;
        }
        
        // References public queues.
        public void SendPublic()
        {
            MessageQueue myQueue = new MessageQueue(".\\myQueue");
            myQueue.Send("Public queue by path name.");

            return;
        }

        // References private queues.
        public void SendPrivate()
        {
            MessageQueue myQueue = new
                MessageQueue(".\\Private$\\myQueue");
            myQueue.Send("Private queue by path name.");

            return;
        }

        // References queues by label.
        public void SendByLabel()
        {
            MessageQueue myQueue = new MessageQueue("Label:TheLabel");
            myQueue.Send("Queue by label.");

            return;
        }

        // References queues by format name.
        public void SendByFormatName()
        {
            MessageQueue myQueue = new
                MessageQueue("FormatName:Public=5A5F7535-AE9A-41d4" +
                "-935C-845C2AFF7112");
            myQueue.Send("Queue by format name.");

            return;
        }

        // References computer journal queues.
        public void MonitorComputerJournal()
        {
            MessageQueue computerJournal = new
                MessageQueue(".\\Journal$");
            while(true)
            {
                Message journalMessage = computerJournal.Receive();
                // Process the journal message.
            }
        }

        // References queue journal queues.
        public void MonitorQueueJournal()
        {
            MessageQueue queueJournal = new
                MessageQueue(".\\myQueue\\Journal$");
            while(true)
            {
                Message journalMessage = queueJournal.Receive();
                // Process the journal message.
            }
        }
        
        // References dead-letter queues.
        public void MonitorDeadLetter()
        {
            MessageQueue deadLetter = new
                MessageQueue(".\\DeadLetter$");
            while(true)
            {
                Message deadMessage = deadLetter.Receive();
                // Process the dead-letter message.
            }
        }

        // References transactional dead-letter queues.
        public void MonitorTransactionalDeadLetter()
        {
            MessageQueue TxDeadLetter = new
                MessageQueue(".\\XactDeadLetter$");
            while(true)
            {
                Message txDeadLetter = TxDeadLetter.Receive();
                // Process the transactional dead-letter message.
            }
        }
    }
}
Imports System.Messaging

Public Class MyNewQueue


        
        ' Provides an entry point into the application.
        '		 
        ' This example demonstrates several ways to set
        ' a queue's path.
        

        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            myNewQueue.SendPublic()
            myNewQueue.SendPrivate()
            myNewQueue.SendByLabel()
            myNewQueue.SendByFormatName()
            myNewQueue.MonitorComputerJournal()
            myNewQueue.MonitorQueueJournal()
            myNewQueue.MonitorDeadLetter()
            myNewQueue.MonitorTransactionalDeadLetter()

            Return

        End Sub


        ' References public queues.
        Public Sub SendPublic()

            Dim myQueue As New MessageQueue(".\myQueue")
            myQueue.Send("Public queue by path name.")

            Return

        End Sub


        ' References private queues.
        Public Sub SendPrivate()

            Dim myQueue As New MessageQueue(".\Private$\myQueue")
            myQueue.Send("Private queue by path name.")

            Return

        End Sub


        ' References queues by label.
        Public Sub SendByLabel()

            Dim myQueue As New MessageQueue("Label:TheLabel")
            myQueue.Send("Queue by label.")

            Return

        End Sub


        ' References queues by format name.
        Public Sub SendByFormatName()

            Dim myQueue As New _
                MessageQueue("FormatName:Public=" + _
                    "5A5F7535-AE9A-41d4-935C-845C2AFF7112")
            myQueue.Send("Queue by format name.")

            Return

        End Sub


        ' References computer journal queues.
        Public Sub MonitorComputerJournal()

            Dim computerJournal As New MessageQueue(".\Journal$")

            While True

                Dim journalMessage As Message = _
                    computerJournal.Receive()

                ' Process the journal message.

            End While

            Return
        End Sub


        ' References queue journal queues.
        Public Sub MonitorQueueJournal()

            Dim queueJournal As New _
                            MessageQueue(".\myQueue\Journal$")

            While True

                Dim journalMessage As Message = _
                    queueJournal.Receive()

                ' Process the journal message.

            End While

            Return
        End Sub


        ' References dead-letter queues.
        Public Sub MonitorDeadLetter()
            Dim deadLetter As New MessageQueue(".\DeadLetter$")

            While True

                Dim deadMessage As Message = deadLetter.Receive()

                ' Process the dead-letter message.

            End While

            Return

        End Sub


        ' References transactional dead-letter queues.
        Public Sub MonitorTransactionalDeadLetter()

            Dim TxDeadLetter As New MessageQueue(".\XactDeadLetter$")

            While True

                Dim txDeadLetterMessage As Message = _
                    TxDeadLetter.Receive()

                ' Process the transactional dead-letter message.

            End While

            Return

        End Sub

End Class

注釈

新しい MessageQueue インスタンスを、パス、形式名、またはラベルがわかっている特定のメッセージ キュー キューに関連付ける場合は、このオーバーロードを使用します。 キューを参照する最初のアプリケーションに排他アクセス権を付与する場合は、DenySharedReceive プロパティを true に設定するか、読み取りアクセス制限パラメーターを渡すコンストラクターを使用する必要があります。

MessageQueue コンストラクターは、MessageQueue クラスの新しいインスタンスをインスタンス化します。新しいメッセージ キュー キューは作成されません。 メッセージ キューで新しいキューを作成するには、Create(String)を使用します。

path パラメーターの構文は、次の表に示すように、参照するキューの種類によって異なります。

キューの種類 構文
パブリック キュー MachineName\QueueName
プライベート キュー MachineName\Private$\QueueName
ジャーナル キュー MachineName\QueueName\Journal$
マシン ジャーナル キュー MachineName\Journal$
マシンの配信不能キュー MachineName\Deadletter$
マシン トランザクション配信不能キュー MachineName\XactDeadletter$

または、次の表に示すように、FormatName または Label を使用してキュー パスを記述することもできます。

参考 構文
形式名 FormatName: [ 形式名 ] FormatName:Public= 5A5F7535-AE9A-41d4-935C-845C2AFF7112

FormatName:DIRECT=SPX: NetworkNumber;HostNumber\QueueName

FormatName:DIRECT=TCP: IPAddress \ QueueName

FormatName:DIRECT=OS: MachineName \ QueueName
ラベル Label: [ ラベル ] theLabel を Label: する

オフラインで作業するには、コンストラクターのパス名構文ではなく、形式名構文を使用する必要があります。 そうしないと、プライマリ ドメイン コントローラーが形式名へのパスを解決できないため、例外がスローされます。

次の表に、MessageQueueのインスタンスの初期プロパティ値を示します。 これらの値は、path パラメーターで指定されたパスを持つメッセージ キュー キューのプロパティに基づいています。

財産 初期値
Authenticate false
BasePriority 0
Category Empty
DefaultPropertiesToSend DefaultPropertiesToSend クラスのパラメーターなしのコンストラクターによって設定される値。
EncryptionRequired true、メッセージ キュー キューのプライバシー レベル設定が "Body" の場合。それ以外の場合は、falseします。
Formatter XmlMessageFormatter
Label Empty
MachineName メッセージ キューキューのコンピューター名プロパティの値。
MaximumJournalSize InfiniteQueueSize
MaximumQueueSize InfiniteQueueSize
MessageReadPropertyFilter MessagePropertyFilter クラスのパラメーターなしのコンストラクターによって設定される値。
Path コンストラクターによって設定されていない場合は、Emptyします。
QueueName コンストラクターによって設定されていない場合は、Emptyします。
DenySharedReceive false
UseJournalQueue true、メッセージ キュー オブジェクトのジャーナル設定が有効になっている場合。それ以外の場合は、falseします。

こちらもご覧ください

適用対象

MessageQueue(String, Boolean)

指定したパスにあるメッセージ キュー キューを参照し、指定した読み取りアクセス制限を使用して、MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, bool sharedModeDenyReceive);
public MessageQueue (string path, bool sharedModeDenyReceive);
new System.Messaging.MessageQueue : string * bool -> System.Messaging.MessageQueue
Public Sub New (path As String, sharedModeDenyReceive As Boolean)

パラメーター

path
String

この MessageQueueによって参照されるキューの場所 。ローカル コンピューターの場合は "." になります。

sharedModeDenyReceive
Boolean

キューにアクセスする最初のアプリケーションに排他読み取りアクセス権を付与する true。それ以外の場合は、falseします。

例外

Path プロパティが無効です。これは、設定されていない可能性があります。

次のコード例では、排他アクセスを使用して新しい MessageQueue を作成し、そのパスを設定して、キューにメッセージを送信します。

#using <system.dll>
#using <system.messaging.dll>

using namespace System;
using namespace System::Messaging;
ref class MyNewQueue
{
public:

   // Requests exlusive read access to the queue. If
   // access is granted, receives a message from the 
   // queue.
   void GetExclusiveAccess()
   {
      try
      {
         
         // Request exclusive read access to the queue.
         MessageQueue^ myQueue = gcnew MessageQueue( ".\\myQueue",true );
         
         // Receive a message. This is where SharingViolation 
         // exceptions would be thrown.
         Message^ myMessage = myQueue->Receive();
      }
      catch ( MessageQueueException^ e ) 
      {
         
         // Handle request for denial of exclusive read access.
         if ( e->MessageQueueErrorCode == MessageQueueErrorCode::SharingViolation )
         {
            Console::WriteLine( "Denied exclusive read access" );
         }

         
         // Handle other sources of a MessageQueueException.
      }

      
      // Handle other exceptions as necessary.
      return;
   }

};


// Provides an entry point into the application.
// This example connects to a message queue, and
// requests exclusive read access to the queue.
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   
   // Output the count of Lowest priority messages.
   myNewQueue->GetExclusiveAccess();
   return 0;
}
using System;
using System.Messaging;

namespace MyProject
{
    /// <summary>
    /// Provides a container class for the example.
    /// </summary>
    public class MyNewQueue
    {
        //**************************************************
        // Provides an entry point into the application.
        //		
        // This example connects to a message queue, and
        // requests exclusive read access to the queue.
        //**************************************************

        public static void Main()
        {
            // Create a new instance of the class.
            MyNewQueue myNewQueue = new MyNewQueue();

            // Output the count of Lowest priority messages.
            GetExclusiveAccess();
                        
            return;
        }

        //**************************************************
        // Requests exlusive read access to the queue. If
        // access is granted, receives a message from the
        // queue.
        //**************************************************
        
        public static void GetExclusiveAccess()
        {
            try
            {
                // Request exclusive read access to the queue.
                MessageQueue myQueue = new
                    MessageQueue(".\\myQueue", true);

                // Receive a message. This is where SharingViolation
                // exceptions would be thrown.
                Message myMessage = myQueue.Receive();
            }
            
            catch (MessageQueueException e)
            {
                // Handle request for denial of exclusive read access.
                if (e.MessageQueueErrorCode ==
                    MessageQueueErrorCode.SharingViolation)
                {
                    Console.WriteLine("Denied exclusive read access");
                }

                // Handle other sources of a MessageQueueException.
            }

            // Handle other exceptions as necessary.

            return;
        }
    }
}
Imports System.Messaging

Public Class MyNewQueue


        ' Provides an entry point into the application.
        '		 
        ' This example connects to a message queue, and
        ' requests exclusive read access to the queue.
 

        Public Shared Sub Main()

            ' Create a new instance of the class.
            Dim myNewQueue As New MyNewQueue()

            ' Output the count of Lowest priority messages.
            myNewQueue.GetExclusiveAccess()

            Return

        End Sub


  
        ' Requests exlusive read access to the queue. If
        ' access is granted, receives a message from the 
        ' queue.
  

        Public Sub GetExclusiveAccess()

            Try

                ' Request exclusive read access to the queue.
                Dim myQueue As New MessageQueue(".\myQueue", True)

                ' Receive a message. This is where a SharingViolation 
                ' exception would be thrown.
                Dim myMessage As Message = myQueue.Receive()

            Catch e As MessageQueueException

                ' Handle request for denial of exclusive read access.
                If e.MessageQueueErrorCode = _
                    MessageQueueErrorCode.SharingViolation Then

                    Console.WriteLine("Denied exclusive read access.")

                End If

                ' Handle other sources of a MessageQueueException.

                ' Handle other exceptions as necessary.

            End Try

            Return

        End Sub

End Class

注釈

このオーバーロードは、パス、形式名、またはラベルがわかっている特定のメッセージ キューキューに新しい MessageQueue を関連付ける場合に使用します。 キューを参照する最初のアプリケーションに排他アクセス権を付与する場合は、sharedModeDenyReceive パラメーターを trueに設定します。 それ以外の場合は、sharedModeDenyReceivefalse に設定するか、path パラメーターのみを持つコンストラクターを使用します。

sharedModeDenyReceivetrue に設定すると、他のアプリケーションを含め、メッセージ キュー キューにアクセスするすべてのオブジェクトに影響します。 パラメーターの効果は、このアプリケーションに限定されません。

MessageQueue コンストラクターは、MessageQueue クラスの新しいインスタンスを作成します。新しいメッセージ キュー キューは作成されません。 メッセージ キューで新しいキューを作成するには、Create(String)を使用します。

path パラメーターの構文は、キューの種類によって異なります。

キューの種類 構文
パブリック キュー MachineName\QueueName
プライベート キュー MachineName\Private$\QueueName
ジャーナル キュー MachineName\QueueName\Journal$
マシン ジャーナル キュー MachineName\Journal$
マシンの配信不能キュー MachineName\Deadletter$
マシン トランザクション配信不能キュー MachineName\XactDeadletter$

または、メッセージ キュー キューの形式名またはラベルを使用して、キュー パスを記述することもできます。

参考 構文
形式名 FormatName: [ 形式名 ] FormatName:Public= 5A5F7535-AE9A-41d4-935C-845C2AFF7112

FormatName:DIRECT=SPX: NetworkNumber;HostNumber\QueueName

FormatName:DIRECT=TCP: IPAddress \ QueueName

FormatName:DIRECT=OS: MachineName \ QueueName
ラベル Label: [ ラベル ] theLabel を Label: する

オフラインで作業するには、フレンドリ名の構文ではなく、形式名の構文を使用する必要があります。 それ以外の場合は、(Active Directory が存在する) プライマリ ドメイン コントローラーを使用して形式名へのパスを解決できないため、例外がスローされます。

MessageQueuesharedModeDenyReceive パラメーターを trueに設定してキューを開くと、その後キューから読み取ろうとするすべての MessageQueue は、共有違反のために MessageQueueException を生成します。 MessageQueueException は、別の MessageQueue が既にキューへの非排他的アクセスを持っている間に、MessageQueue が排他的モードでキューにアクセスしようとした場合にもスローされます。

次の表に、MessageQueueのインスタンスの初期プロパティ値を示します。 これらの値は、メッセージ キュー キューのプロパティと、path パラメーターで指定されたパスに基づいています。

財産 初期値
Authenticate false.
BasePriority 0.
Category Empty.
DefaultPropertiesToSend DefaultPropertiesToSend クラスのパラメーターなしのコンストラクターによって設定される値。
EncryptionRequired true、メッセージ キュー キューのプライバシー レベル設定が "Body" の場合。それ以外の場合は、falseします。
Formatter XmlMessageFormatter.
Label Empty.
MachineName メッセージ キューキューのコンピューター名プロパティの値。
MaximumJournalSize InfiniteQueueSize.
MaximumQueueSize InfiniteQueueSize.
MessageReadPropertyFilter MessagePropertyFilter クラスのパラメーターなしのコンストラクターによって設定される値。
Path コンストラクターによって設定されていない場合は、Emptyします。
QueueName コンストラクターによって設定されていない場合は、Emptyします。
DenySharedReceive sharedModeDenyReceive パラメーターの値。
UseJournalQueue true、メッセージ キュー オブジェクトのジャーナル設定が有効になっている場合。それ以外の場合は、falseします。

こちらもご覧ください

適用対象

MessageQueue(String, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, System::Messaging::QueueAccessMode accessMode);
public MessageQueue (string path, System.Messaging.QueueAccessMode accessMode);
new System.Messaging.MessageQueue : string * System.Messaging.QueueAccessMode -> System.Messaging.MessageQueue
Public Sub New (path As String, accessMode As QueueAccessMode)

パラメーター

path
String

この MessageQueueによって参照されるキューの場所 。ローカル コンピューターの場合は "." になります。

accessMode
QueueAccessMode

QueueAccessMode 値の 1 つ。

適用対象

MessageQueue(String, Boolean, Boolean)

MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, bool sharedModeDenyReceive, bool enableCache);
public MessageQueue (string path, bool sharedModeDenyReceive, bool enableCache);
new System.Messaging.MessageQueue : string * bool * bool -> System.Messaging.MessageQueue
Public Sub New (path As String, sharedModeDenyReceive As Boolean, enableCache As Boolean)

パラメーター

path
String

この MessageQueueによって参照されるキューの場所 。ローカル コンピューターの場合は "." になります。

sharedModeDenyReceive
Boolean

キューにアクセスする最初のアプリケーションに排他読み取りアクセス権を付与する true。それ以外の場合は、falseします。

enableCache
Boolean

接続キャッシュを作成して使用する true。それ以外の場合は、falseします。

次のコード例では、排他読み取りアクセスと接続キャッシュが有効な新しい MessageQueue を作成します。

// Connect to a queue on the local computer, grant exclusive read
// access to the first application that accesses the queue, and
// enable connection caching.
MessageQueue^ queue = gcnew MessageQueue(".\\exampleQueue", true, true);

queue->Close();
// Connect to a queue on the local computer, grant exclusive read
// access to the first application that accesses the queue, and
// enable connection caching.
MessageQueue queue = new MessageQueue(".\\exampleQueue", true, true);

適用対象

MessageQueue(String, Boolean, Boolean, QueueAccessMode)

MessageQueue クラスの新しいインスタンスを初期化します。

public:
 MessageQueue(System::String ^ path, bool sharedModeDenyReceive, bool enableCache, System::Messaging::QueueAccessMode accessMode);
public MessageQueue (string path, bool sharedModeDenyReceive, bool enableCache, System.Messaging.QueueAccessMode accessMode);
new System.Messaging.MessageQueue : string * bool * bool * System.Messaging.QueueAccessMode -> System.Messaging.MessageQueue
Public Sub New (path As String, sharedModeDenyReceive As Boolean, enableCache As Boolean, accessMode As QueueAccessMode)

パラメーター

path
String

この MessageQueueによって参照されるキューの場所 。ローカル コンピューターの場合は "." になります。

sharedModeDenyReceive
Boolean

キューにアクセスする最初のアプリケーションに排他読み取りアクセス権を付与する true。それ以外の場合は、falseします。

enableCache
Boolean

接続キャッシュを作成して使用する true。それ以外の場合は、falseします。

accessMode
QueueAccessMode

QueueAccessMode 値の 1 つ。

適用対象