?
Solved

Accessing Message Queue thru VB6 dll on 64-bit OS, Error 5 Invalid Procedure or argument

Posted on 2008-06-13
2
Medium Priority
?
432 Views
Last Modified: 2013-11-26
I am calling a function from a VB6 dll that sends a message to a queue. The message is sent correctly unless I am using Windows 64-bit OS (with the VB6 dll registered there) then I get the Error 5, Invalid procedure or arguement error message..
0
Comment
Question by:TerryWS
[X]
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 Comments
 
LVL 22

Expert Comment

by:cookre
ID: 21787445
Code?
0
 

Accepted Solution

by:
TerryWS earned 0 total points
ID: 21792761

Public Sub SendMessage(ByVal sMessage As String)
On Error GoTo PROC_ERR
    
    Const PROC_NAME As String = ".SendMessage"
    
    Dim oOpenQueue As MSMQQueue
    Dim oQueueMessage As MSMQMessage
    Dim oQueueInfo As MSMQQueueInfo
    Dim sQueueName As String
    
    sQueueName = GetPDFrequestQueueID
    
    'make sure we have a queue name
    If Len(Trim$(sQueueName)) = 0 Then
        On Error GoTo 0
        Err.Raise ERROR_EMPTY_MSMQNAME, MODULE_NAME & PROC_NAME, "Queue Name can not be empty."
    End If
    
    'set the name of the queue to open
    Set oQueueInfo = New MSMQQueueInfo
        oQueueInfo.FormatName = sQueueName
        
        'open the queue
        Set oOpenQueue = oQueueInfo.Open(MQ_SEND_ACCESS, MQ_DENY_NONE)
        
            'create the message to put in the queue
            Set oQueueMessage = New MSMQMessage
                With oQueueMessage
                    .Label = "PDF Request"
                    .Body = sMessage
                    .AppSpecific = 0
                    .Delivery = MQMSG_DELIVERY_EXPRESS
                End With
                
                'send the message
                oQueueMessage.Send oOpenQueue, MQ_NO_TRANSACTION
            Set oQueueMessage = Nothing
            
            'close the queue
            oOpenQueue.Close
        
        Set oOpenQueue = Nothing
    Set oQueueInfo = Nothing
    
PROC_EXIT:
    Exit Sub
 
PROC_ERR:
    Dim lError As Long
    Dim sDesc As String
    Dim sSource As String
    Dim sHelpFile As String
    Dim lHelpContext As Long
    With Err
        lError = .Number
        sDesc = .Description
        sSource = MODULE_NAME & PROC_NAME & " - " & .Source
        sHelpFile = .HelpFile
        lHelpContext = .HelpContext
    End With
    
    Set oQueueMessage = Nothing
    If Not (oOpenQueue Is Nothing) Then
        oOpenQueue.Close
    End If
    Set oOpenQueue = Nothing
    Set oQueueInfo = Nothing
    
    Err.Raise lError, sSource, sDesc, sHelpFile, lHelpContext
End Sub

Open in new window

0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Ready to improve network connectivity? Watch this webinar to learn how SD-WANs and a one-click instant connect tool can boost provisions, deployment, and management of your cloud connection.

Question has a verified solution.

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

This article will show how Aten was able to supply easy management and control for Artear's video walls and wide range display configurations of their newsroom.
If something goes wrong with Exchange, your IT resources are in trouble.All Exchange server migration processes are not designed to be identical and though migrating email from on-premises Exchange mailbox to Cloud’s Office 365 is relatively simple…
XMind Plus helps organize all details/aspects of any project from large to small in an orderly and concise manner. If you are working on a complex project, use this micro tutorial to show you how to make a basic flow chart. The software is free when…
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …
Suggested Courses

649 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