May 21st, 1999, 09:39 AM
I'm trying to instantiate and use an ActiveX DLL created in Visual Basic 6 from Visual C++ 6.... Instantiation works well, but when I try to call this function, I get an exception...
Public Sub Init(ByRef strServer As String, Optional ByRef vntSendQueue As Variant, Optional ByRef vntReceiveQueue As Variant, Optional ByVal udtAccessMode As AccessEnum = AccessEnum.MQ_RECEIVE_ACCESS)
The C++ I use look like this... I'm pretty new to using ActiveX/COM with VC++ so all comments would be nice!!
#import "D:\Proj\Skbl\Resources\srvMSMQ.dll" no_namespace rename("EOF", "EndOfFile")
#include <stdio.h>
#include <windows.h>
#include <wtypes.h>
_CMSMQPtr p;
void main(void)
{
::CoInitialize(NULL);
BSTR strServer;
_variant_t strQ;
strQ.SetString("srvWrapCPackVerifyQ");
strServer = SysAllocString((OLECHAR FAR *) "KASRV220");
if (p.CreateInstance(__uuidof(CMSMQ)) == S_OK)
{
p->Init(&strServer, &strQ, &strQ, MQ_SEND_ACCESS);
p->SendMessage((BSTR *) "Test", (BSTR *) "Test", Priority3, MQMSG_DELIVERY_RECOVERABLE);
}
return;
}
Maybe some of you could enlighten me and tell me what COM types to use in these cases? I have tried the VARIANT types instead of _variant_t
Regards!
/Thomas
Public Sub Init(ByRef strServer As String, Optional ByRef vntSendQueue As Variant, Optional ByRef vntReceiveQueue As Variant, Optional ByVal udtAccessMode As AccessEnum = AccessEnum.MQ_RECEIVE_ACCESS)
The C++ I use look like this... I'm pretty new to using ActiveX/COM with VC++ so all comments would be nice!!
#import "D:\Proj\Skbl\Resources\srvMSMQ.dll" no_namespace rename("EOF", "EndOfFile")
#include <stdio.h>
#include <windows.h>
#include <wtypes.h>
_CMSMQPtr p;
void main(void)
{
::CoInitialize(NULL);
BSTR strServer;
_variant_t strQ;
strQ.SetString("srvWrapCPackVerifyQ");
strServer = SysAllocString((OLECHAR FAR *) "KASRV220");
if (p.CreateInstance(__uuidof(CMSMQ)) == S_OK)
{
p->Init(&strServer, &strQ, &strQ, MQ_SEND_ACCESS);
p->SendMessage((BSTR *) "Test", (BSTR *) "Test", Priority3, MQMSG_DELIVERY_RECOVERABLE);
}
return;
}
Maybe some of you could enlighten me and tell me what COM types to use in these cases? I have tried the VARIANT types instead of _variant_t
Regards!
/Thomas