Accessing ActiveX VB function within C++ App

P

Paul Brun

I have a VB function that I need to get from my C++ App, however, I have
tried numerous
mechanisms to access it, however, I do not get an appropriate return value.

I have one function that takes in three parameters called Generate(long,
int, int) and it returns
a long. Here is a snippet of the code. I used the appropriate #import
statement from my stdafx.h
file and the DLL is available within the runtime directory. Help would be
appreciated.

HRESULT hresult;
CLSID clsid;
CoInitialize(NULL);
hresult = CLSIDFromProgID(OLESTR("ProjectName.Classname"), &clsid);
_ClassPtr *t;

hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,
__uuidof(_ClassPtr), (LPVOID*) &t);

if (FAILED(hresult))
{
....
}

long generatedMOP = t->Generate(&SysID, &agents, &nodes);

t->Release();
CoUninitialize();



Assistance would be appreciated.
Thank you
Paul
 
P

Paul Brun

I figured it out.......the function I was calling was returning something different then what I was
expecting. I worked out the differences and now everything is good.

Thanks for replying though.

Paul
Try LoadLibrary(HANDLE); function.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top