[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How to check if MSMQ is installed on the system?

Posted on 2006-07-13
4
Medium Priority
?
1,387 Views
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!
0
Comment
Question by:waywaylu
  • 2
3 Comments
 
LVL 2

Expert Comment

by:mmendezs
ID: 17103979
Hope this helps:

http://support.gfi.com/manuals/en/me12/me12manual-1-53.html

Best regards
Mauricio
0
 
LVL 15

Accepted Solution

by:
Ralf Klatt earned 150 total points
ID: 17104292
Hi,

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


'========================================================================================================

Private Const FORMAT_MESSAGE_FROM_SYSTEM = &H1000
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
    Else
        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,
Raisor
0
 
LVL 15

Expert Comment

by:Ralf Klatt
ID: 17273450
Hi,

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


Best regards,
Raisor
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

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

What do responsible coders do? They don't take detrimental shortcuts. They do take reasonable security precautions, create important automation, implement sufficient logging, fix things they break, and care about users.
If you are a mobile app developer and especially develop hybrid mobile apps then these 4 mistakes you must avoid for hybrid app development to be the more genuine app developer.
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 …
Screencast - Getting to Know the Pipeline

873 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