MessageQueue.GetPublicQueuesByMachine メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > MessageQueue.GetPublicQueuesByMachine メソッドの意味・解説 

MessageQueue.GetPublicQueuesByMachine メソッド

指定したコンピュータにあるすべてのパブリック キュー取得します

名前空間: System.Messaging
アセンブリ: System.Messaging (system.messaging.dll 内)
構文構文

Public Shared Function GetPublicQueuesByMachine
 ( _
    machineName As String _
) As MessageQueue()
Dim machineName As String
Dim returnValue As MessageQueue()

returnValue = MessageQueue.GetPublicQueuesByMachine(machineName)
public static MessageQueue[] GetPublicQueuesByMachine
 (
    string machineName
)
public:
static array<MessageQueue^>^ GetPublicQueuesByMachine (
    String^ machineName
)
public static MessageQueue[] GetPublicQueuesByMachine
 (
    String machineName
)
public static function GetPublicQueuesByMachine
 (
    machineName : String
) : MessageQueue[]

パラメータ

machineName

取得するパブリック キューセット含まれているコンピュータの名前。

戻り値
コンピュータパブリック キュー参照する MessageQueue オブジェクト配列

例外例外
例外種類条件

ArgumentException

machineName パラメータ構文が不正です。

MessageQueueException

メッセージ キューメソッドアクセスしたときにエラー発生しました

解説解説
使用例使用例

キューの一覧を取得するコード例次に示します

Imports System
Imports System.Messaging

Public Class MyNewQueue


        
        ' Provides an entry point into the application.
        '         
        ' This example gets lists of queues by a variety
        ' of criteria.


        Public Shared Sub
 Main()

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

            ' Send normal and high priority messages.
            myNewQueue.GetQueuesByCategory()
            myNewQueue.GetQueuesByLabel()
            myNewQueue.GetQueuesByComputer()
            myNewQueue.GetAllPublicQueues()
            myNewQueue.GetPublicQueuesByCriteria()
            myNewQueue.GetPrivateQueues()

            Return

        End Sub 'Main



        ' Gets a list of queues with a specified category.
        ' Sends a broadcast message to all queues in that
        ' category.
 
        Public Sub GetQueuesByCategory()

            ' Get a list of queues with the specified category.
            Dim QueueList As MessageQueue()
 = _
                MessageQueue.GetPublicQueuesByCategory(New _
                Guid("{00000000-0000-0000-0000-000000000001}"))

            ' Send a broadcast message to each queue in the array.
            Dim queueItem As MessageQueue
            For Each queueItem In
 QueueList
                queueItem.Send("Broadcast message.")
            Next queueItem

            Return

        End Sub 'GetQueuesByCategory



        ' Gets a list of queues with a specified label.
        ' Sends a broadcast message to all queues with that
        ' label.


        Public Sub GetQueuesByLabel()

            ' Get a list of queues with the specified label.
            Dim QueueList As MessageQueue()
 = _
                MessageQueue.GetPublicQueuesByLabel("My Label")

            ' Send a broadcast message to each queue in the array.
            Dim queueItem As MessageQueue
            For Each queueItem In
 QueueList
                queueItem.Send("Broadcast message.")
            Next queueItem

            Return

        End Sub 'GetQueuesByLabel



        ' Gets a list of queues on a specified computer. 
        ' Displays the list on screen.
 

        Public Sub GetQueuesByComputer()

            ' Get a list of queues on the specified computer.
            Dim QueueList As MessageQueue()
 = _
                MessageQueue.GetPublicQueuesByMachine("MyComputer")

            ' Display the paths of the queues in the list.
            Dim queueItem As MessageQueue
            For Each queueItem In
 QueueList
                Console.WriteLine(queueItem.Path)
            Next queueItem

            Return

        End Sub 'GetQueuesByComputer



        ' Gets a list of all public queues.
       

        Public Sub GetAllPublicQueues()

            ' Get a list of public queues.
            Dim QueueList As MessageQueue()
 = _
                MessageQueue.GetPublicQueues()

            Return

        End Sub 'GetAllPublicQueues


 
        ' Gets a list of all public queues that match 
        ' specified criteria. Displays the list on 
        ' screen.


        Public Sub GetPublicQueuesByCriteria()

            ' Define criteria to filter the queues.
            Dim myCriteria As New
 MessageQueueCriteria()
            myCriteria.CreatedAfter = DateTime.Now.Subtract(New
 _
                TimeSpan(1, 0, 0, 0))
            myCriteria.ModifiedBefore = DateTime.Now
            myCriteria.MachineName = "."
            myCriteria.Label = "My Queue"

            ' Get a list of queues with that criteria.
            Dim QueueList As MessageQueue()
 = _
                MessageQueue.GetPublicQueues(myCriteria)

            ' Display the paths of the queues in the list.
            Dim queueItem As MessageQueue
            For Each queueItem In
 QueueList
                Console.WriteLine(queueItem.Path)
            Next queueItem

            Return

        End Sub 'GetPublicQueuesByCriteria


 
        ' Gets a list of private queues on the local 
        ' computer. Displays the list on screen.
  

        Public Sub GetPrivateQueues()

            ' Get a list of queues with the specified category.
            Dim QueueList As MessageQueue()
 = _
                MessageQueue.GetPrivateQueuesByMachine(".")

            ' Display the paths of the queues in the list.
            Dim queueItem As MessageQueue
            For Each queueItem In
 QueueList
                Console.WriteLine(queueItem.Path)
            Next queueItem

            Return

        End Sub 'GetPrivateQueues

End Class 'MyNewQueue

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 gets lists of queues by a variety
        // of criteria.
        //**************************************************

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

            // Send normal and high priority messages.
            myNewQueue.GetQueuesByCategory();
            myNewQueue.GetQueuesByLabel();
            myNewQueue.GetQueuesByComputer();
            myNewQueue.GetAllPublicQueues();
            myNewQueue.GetPublicQueuesByCriteria();
            myNewQueue.GetPrivateQueues();
                        
            return;
        }


        //**************************************************
        // Gets a list of queues with a specified category.
        // Sends a broadcast message to all queues in that
        // category.
        //**************************************************
        
        public void GetQueuesByCategory()
        {
            // Get a list of queues with the specified category.
            MessageQueue[] QueueList = 
                MessageQueue.GetPublicQueuesByCategory(new 
                Guid("{00000000-0000-0000-0000-000000000001}"));

            // Send a broadcast message to each queue in the array.
            foreach(MessageQueue queueItem in
 QueueList)
            {
                queueItem.Send("Broadcast message.");
            }
            
            return;
        }


        //**************************************************
        // Gets a list of queues with a specified label.
        // Sends a broadcast message to all queues with that
        // label.
        //**************************************************
        
        public void GetQueuesByLabel()
        {
            // Get a list of queues with the specified label.
            MessageQueue[] QueueList = 
                MessageQueue.GetPublicQueuesByLabel("My Label");

            // Send a broadcast message to each queue in the array.
            foreach(MessageQueue queueItem in
 QueueList)
            {
                queueItem.Send("Broadcast message.");
            }
            
            return;
        }


        //**************************************************
        // Gets a list of queues on a specified computer. 
        // Displays the list on screen.
        //**************************************************
        
        public void GetQueuesByComputer()
        {
            // Get a list of queues on the specified computer.
            MessageQueue[] QueueList = 
                MessageQueue.GetPublicQueuesByMachine("MyComputer");

            // Display the paths of the queues in the list.
            foreach(MessageQueue queueItem in
 QueueList)
            {
                Console.WriteLine(queueItem.Path);
            }

            return;
        }


        //**************************************************
        // Gets a list of all public queues.
        //**************************************************
        
        public void GetAllPublicQueues()
        {
            // Get a list of public queues.
            MessageQueue[] QueueList = 
                MessageQueue.GetPublicQueues();
    
            return;
        }


        //**************************************************
        // Gets a list of all public queues that match 
        // specified criteria. Displays the list on 
        // screen.
        //**************************************************
        
        public void GetPublicQueuesByCriteria()
        {
            // Define criteria to filter the queues.
            MessageQueueCriteria myCriteria = new 
                MessageQueueCriteria();
            myCriteria.CreatedAfter = DateTime.Now.Subtract(new
 
                TimeSpan(1,0,0,0));
            myCriteria.ModifiedBefore = DateTime.Now;
            myCriteria.MachineName = ".";
            myCriteria.Label = "My Queue";
            
            // Get a list of queues with that criteria.
            MessageQueue[] QueueList = 
                MessageQueue.GetPublicQueues(myCriteria);

            // Display the paths of the queues in the list.
            foreach(MessageQueue queueItem in
 QueueList)
            {
                Console.WriteLine(queueItem.Path);
            }

            return;
        }


        //**************************************************
        // Gets a list of private queues on the local 
        // computer. Displays the list on screen.
        //**************************************************
        
        public void GetPrivateQueues()
        {
            // Get a list of queues with the specified category.
            MessageQueue[] QueueList = 
                MessageQueue.GetPrivateQueuesByMachine(".");

            // Display the paths of the queues in the list.
            foreach(MessageQueue queueItem in
 QueueList)
            {
                Console.WriteLine(queueItem.Path);
            }
            
            return;
        }
    }
}
#using <system.dll>
#using <system.messaging.dll>

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

   // Gets a list of queues with a specified category.
   // Sends a broadcast message to all queues in that
   // category.
   void GetQueuesByCategory()
   {
      
      // Get a list of queues with the specified category.
      array<MessageQueue^>^QueueList = MessageQueue::GetPublicQueuesByCategory(
 Guid(" {00000000-0000-0000-0000-000000000001}") );
      
      // Send a broadcast message to each queue in the array.
      IEnumerator^ myEnum = QueueList->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         MessageQueue^ queueItem = safe_cast<MessageQueue^>(myEnum->Current);
         queueItem->Send( "Broadcast message." );
      }

      return;
   }


   // Gets a list of queues with a specified label.
   // Sends a broadcast message to all queues with that
   // label.
   void GetQueuesByLabel()
   {
      
      // Get a list of queues with the specified label.
      array<MessageQueue^>^QueueList = MessageQueue::GetPublicQueuesByLabel(
 "My Label" );
      
      // Send a broadcast message to each queue in the array.
      IEnumerator^ myEnum = QueueList->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         MessageQueue^ queueItem = safe_cast<MessageQueue^>(myEnum->Current);
         queueItem->Send( "Broadcast message." );
      }

      return;
   }


   // Gets a list of queues on a specified computer. 
   // Displays the list on screen.
   void GetQueuesByComputer()
   {
      
      // Get a list of queues on the specified computer.
      array<MessageQueue^>^QueueList = MessageQueue::GetPublicQueuesByMachine(
 "MyComputer" );
      
      // Display the paths of the queues in the list.
      IEnumerator^ myEnum = QueueList->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         MessageQueue^ queueItem = safe_cast<MessageQueue^>(myEnum->Current);
         Console::WriteLine( queueItem->Path );
      }

      return;
   }


   // Gets a list of all public queues.
   void GetAllPublicQueues()
   {
      
      // Get a list of public queues.
      array<MessageQueue^>^QueueList = MessageQueue::GetPublicQueues();
      return;
   }


   // Gets a list of all public queues that match 
   // specified criteria. Displays the list on 
   // screen.
   void GetPublicQueuesByCriteria()
   {
      
      // Define criteria to filter the queues.
      MessageQueueCriteria^ myCriteria = gcnew MessageQueueCriteria;
      myCriteria->CreatedAfter = DateTime::Now.Subtract( TimeSpan(1,0,0,0) );
      myCriteria->ModifiedBefore = DateTime::Now;
      myCriteria->MachineName = ".";
      myCriteria->Label = "My Queue";
      
      // Get a list of queues with that criteria.
      array<MessageQueue^>^QueueList = MessageQueue::GetPublicQueues( myCriteria
 );
      
      // Display the paths of the queues in the list.
      IEnumerator^ myEnum = QueueList->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         MessageQueue^ queueItem = safe_cast<MessageQueue^>(myEnum->Current);
         Console::WriteLine( queueItem->Path );
      }

      return;
   }


   // Gets a list of private queues on the local 
   // computer. Displays the list on screen.
   void GetPrivateQueues()
   {
      
      // Get a list of queues with the specified category.
      array<MessageQueue^>^QueueList = MessageQueue::GetPrivateQueuesByMachine(
 "." );
      
      // Display the paths of the queues in the list.
      IEnumerator^ myEnum = QueueList->GetEnumerator();
      while ( myEnum->MoveNext() )
      {
         MessageQueue^ queueItem = safe_cast<MessageQueue^>(myEnum->Current);
         Console::WriteLine( queueItem->Path );
      }

      return;
   }

};


// Provides an entry point into the application.
// This example gets lists of queues by a variety
// of criteria.
int main()
{
   
   // Create a new instance of the class.
   MyNewQueue^ myNewQueue = gcnew MyNewQueue;
   
   // Send normal and high priority messages.
   myNewQueue->GetQueuesByCategory();
   myNewQueue->GetQueuesByLabel();
   myNewQueue->GetQueuesByComputer();
   myNewQueue->GetAllPublicQueues();
   myNewQueue->GetPublicQueuesByCriteria();
   myNewQueue->GetPrivateQueues();
   return 0;
}

package MyProject;

import System.*;
import System.Messaging.*;

/// <summary>
/// Provides a container class for the example.
/// </summary>
public class MyNewQueue
{
    //**************************************************
    // Provides an entry point into the application.
    //         
    // This example gets lists of queues by a variety
    // of criteria.
    //**************************************************
    public static void main(String[]
 args)
    {
        // Create a new instance of the class.
        MyNewQueue myNewQueue = new MyNewQueue();
        // Send normal and high priority messages.
        myNewQueue.GetQueuesByCategory();
        myNewQueue.GetQueuesByLabel();
        myNewQueue.GetQueuesByComputer();
        myNewQueue.GetAllPublicQueues();
        myNewQueue.GetPublicQueuesByCriteria();
        myNewQueue.GetPrivateQueues();

        return;
    } //main

    //**************************************************
    // Gets a list of queues with a specified category.
    // Sends a broadcast message to all queues in that
    // category.
    //**************************************************
    public void GetQueuesByCategory()
    {
        // Get a list of queues with the specified category.
        MessageQueue queueList[] = MessageQueue.GetPublicQueuesByCategory(
            new Guid("{00000000-0000-0000-0000-000000000001}"));
        // Send a broadcast message to each queue in the array.
        for (int iCtr = 0; iCtr < queueList.length;
 iCtr++) {
            MessageQueue queueItem = queueList[iCtr];
            queueItem.Send("Broadcast message.");
        }

        return;
    } //GetQueuesByCategory

    //**************************************************
    // Gets a list of queues with a specified label.
    // Sends a broadcast message to all queues with that
    // label.
    //**************************************************
    public void GetQueuesByLabel()
    {
        // Get a list of queues with the specified label.
        MessageQueue queueList[] =
            MessageQueue.GetPublicQueuesByLabel("My Label");
        // Send a broadcast message to each queue in the array.
        for (int iCtr = 0; iCtr < queueList.length;
 iCtr++) {
            MessageQueue queueItem = queueList[iCtr];
            queueItem.Send("Broadcast message.");
        }

        return;
    } //GetQueuesByLabel

    //**************************************************
    // Gets a list of queues on a specified computer. 
    // Displays the list on screen.
    //**************************************************
    public void GetQueuesByComputer()
    {
        // Get a list of queues on the specified computer.
        MessageQueue queueList[] =
            MessageQueue.GetPublicQueuesByMachine("MyComputer");
        // Display the paths of the queues in the list.
        for (int iCtr = 0; iCtr < queueList.length;
 iCtr++) {
            MessageQueue queueItem = queueList[iCtr];
            Console.WriteLine(queueItem.get_Path());
        }

        return;
    } //GetQueuesByComputer

    //**************************************************
    // Gets a list of all public queues.
    //**************************************************
    public void GetAllPublicQueues()
    {
        // Get a list of public queues.
        MessageQueue queueList[] = MessageQueue.GetPublicQueues();

        return;
    } //GetAllPublicQueues

    //**************************************************
    // Gets a list of all public queues that match 
    // specified criteria. Displays the list on 
    // screen.
    //**************************************************
    public void GetPublicQueuesByCriteria()
    {
        // Define criteria to filter the queues.
        MessageQueueCriteria myCriteria = new MessageQueueCriteria();
        myCriteria.set_CreatedAfter(DateTime.get_Now().Subtract(
            new TimeSpan(1, 0, 0, 0)));
        myCriteria.set_ModifiedBefore(DateTime.get_Now());
        myCriteria.set_MachineName(".");
        myCriteria.set_Label("My Queue");
        // Get a list of queues with that criteria.
        MessageQueue queueList[] = MessageQueue.GetPublicQueues(myCriteria);
        // Display the paths of the queues in the list.
        for (int iCtr = 0; iCtr < queueList.length;
 iCtr++) {
            MessageQueue queueItem = queueList[iCtr];
            Console.WriteLine(queueItem.get_Path());
        }

        return;
    } //GetPublicQueuesByCriteria

    //**************************************************
    // Gets a list of private queues on the local 
    // computer. Displays the list on screen.
    //**************************************************
    public void GetPrivateQueues()
    {
        // Get a list of queues with the specified category.
        MessageQueue queueList[] = MessageQueue.GetPrivateQueuesByMachine(".");
        // Display the paths of the queues in the list.
        for (int iCtr = 0; iCtr < queueList.length;
 iCtr++) {
            MessageQueue queueItem = queueList[iCtr];
            Console.WriteLine(queueItem.get_Path());
        }

        return;
    } //GetPrivateQueues
} //MyNewQueue
.NET Framework のセキュリティ.NET Frameworkセキュリティ
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
MessageQueue クラス
MessageQueue メンバ
System.Messaging 名前空間
MachineName
GetPublicQueues
GetMessageQueueEnumerator



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「MessageQueue.GetPublicQueuesByMachine メソッド」の関連用語

MessageQueue.GetPublicQueuesByMachine メソッドのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



MessageQueue.GetPublicQueuesByMachine メソッドのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS