How to check if MSMQ is installed on the system?

Posted on 2006-07-13
Last Modified: 2012-06-21
How to check if MSMQ is installed on the system? In my program, I need to check to see if MSMQ is installed. If yes, I need to create some message queue. Thanks!
Question by:waywaylu
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2

Expert Comment

ID: 17103979
Hope this helps:

Best regards
LVL 15

Accepted Solution

Raisor earned 50 total points
ID: 17104292

If Visual Basic is a language you'd be able to work with I'd suggest the following code:


Private Const MAX_MESSAGE_LENGTH = 512

Private Declare Function GetLastError Lib "kernel32" () As Long

Private Declare Function FormatMessage Lib "kernel32" Alias "FormatMessageA" (ByVal dwFlags As Long, lpSource As Any, ByVal dwMessageId As Long, ByVal dwLanguageId As Long, ByVal lpBuffer As String, ByVal nSize As Long, Arguments As Long) As Long

Private Declare Function LoadLibrary Lib "kernel32" Alias "LoadLibraryA" (ByVal lpLibFileName As String) As Long

Private Declare Function FreeLibrary Lib "kernel32" (ByVal hLibModule As Long) As Long

Function IsMSMQAvailable() As Boolean
    Dim hModule As Long
    hModule = LoadLibrary("msmqocm.dll")
    If hModule > 32 Then
        FreeLibrary hModule
        IsMSMQAvailable = True
        IsMSMQAvailable = False
    End If
End Function

Private Function GetAPIErrorMessageDescription(ByVal ErrNumber As Integer) As String
    Dim sError As String * MAX_MESSAGE_LENGTH
    Dim lErrMsgLen As Integer '32 bit message identifier
    lErrMsgLen = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, 0, ErrNumber, 0, sError, MAX_MESSAGE_LENGTH, 0)
    If lErrMsgLen > 0 Then
        GetAPIErrorMessageDescription = sError
    End If
End Function


You'd just have to call "If IsMSMQAvailable() Then ..."

Best regards,
LVL 15

Expert Comment

ID: 17273450

@waywaylu ... thank you for having chosen my answer ... but, what was wrong with it? ... why that grade of "B"?

Best regards,

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

A short article about a problem I had getting the GPS LocationListener working.
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
An introduction to basic programming syntax in Java by creating a simple program. Viewers can follow the tutorial as they create their first class in Java. Definitions and explanations about each element are given to help prepare viewers for future …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question