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

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..
TerryWSAsked:
Who is Participating?
 
TerryWSAuthor Commented:

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
 
cookreCommented:
Code?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.