MessageQueue.Exists メソッド
アセンブリ: System.Messaging (system.messaging.dll 内)

Dim path As String Dim returnValue As Boolean returnValue = MessageQueue.Exists(path)
戻り値
指定したパスにキューが存在する場合は true。それ以外の場合は false。


Exists メソッドは、指定したパスにメッセージ キューのキューが存在するかどうかを判断します。指定した書式名のキューが存在するかどうかを判断するメソッドはありません。書式名構文およびその他のパス構文の書式の詳細については、Path プロパティのトピックを参照してください。
Exists は、負荷が高い操作です。アプリケーションで必要な場合にだけ使用してください。
![]() |
---|
path パラメータの構文は、キューの種類によって異なります。詳細については、次の表を参照してください。
リモート プライベート キューの存在を確認するために、Exists を呼び出すことができませんでした。
構文の詳細については、Path プロパティのトピックを参照してください。
Label を使用してキューのパスを記述することもできます。
このメソッドが各種のワークグループ モードで使用できるかどうかを次の表に示します。

メッセージ キューのキューが存在するかどうかを確認してから、それを削除するコード例を次に示します。
Imports System Imports System.Messaging Public Class MyNewQueue ' Provides an entry point into the application. ' ' This example verifies existence and attempts to ' delete a queue. Public Shared Sub Main() ' Determine whether the queue exists. If MessageQueue.Exists(".\myQueue") Then Try ' Delete the queue. MessageQueue.Delete(".\myQueue") Catch e As MessageQueueException If e.MessageQueueErrorCode = _ MessageQueueErrorCode.AccessDenied Then Console.WriteLine("Access is denied. " _ + "Queue might be a system queue.") End If ' Handle other sources of exceptions as necessary. End Try End If Return End Sub 'Main 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 verifies existence and attempts to // delete a queue. //************************************************** public static void Main() { // Determine whether the queue exists. if (MessageQueue.Exists(".\\myQueue")) { try { // Delete the queue. MessageQueue.Delete(".\\myQueue"); } catch(MessageQueueException e) { if(e.MessageQueueErrorCode == MessageQueueErrorCode.AccessDenied) { Console.WriteLine("Access is denied. " + "Queue might be a system queue."); } // Handle other sources of MessageQueueException. } } return; } } }
#using <system.dll> #using <system.messaging.dll> using namespace System; using namespace System::Messaging; int main() { // Determine whether the queue exists. if ( MessageQueue::Exists( ".\\myQueue" ) ) { try { // Delete the queue. MessageQueue::Delete( ".\\myQueue" ); } catch ( MessageQueueException^ e ) { if ( e->MessageQueueErrorCode == MessageQueueErrorCode::AccessDenied ) { Console::WriteLine( "Access is denied. Queue might be a system queue." ); } // Handle other sources of MessageQueueException. } } 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 verifies existence and attempts to // delete a queue. //************************************************** public static void main(String[] args) { // Determine whether the queue exists. if (MessageQueue.Exists(".\\myQueue")) { try { // Delete the queue. MessageQueue.Delete(".\\myQueue"); } catch (MessageQueueException e) { if (e.get_MessageQueueErrorCode(). Equals(MessageQueueErrorCode.AccessDenied)) { Console.WriteLine("Access is denied. " + "Queue might be a system queue."); } // Handle other sources of MessageQueueException. } } return; } //main } //MyNewQueue


Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
開発プラットフォームの中には、.NET Framework によってサポートされていないバージョンがあります。サポートされているバージョンについては、「システム要件」を参照してください。


Weblioに収録されているすべての辞書からMessageQueue.Exists メソッドを検索する場合は、下記のリンクをクリックしてください。

- MessageQueue.Exists メソッドのページへのリンク