Help I am COM (pletely) lost
Discussion
I need a little (lol a lot of) help from any COM/C++ gurus out there in PH land. I am trying to interface with a COM dll from my VC++ app and it is proving a bit of a headache and I could do with a few pointers. (no pun intended!). I have had a look at the TypeLib via the OLE/COM viewer and think I have started on the right track .... small code fragment mode:
header file
class CIQiointf
{
public:
virtual HRESULT QioTrySignon(BSTR,LONG*);
};
.cpp file
CIQiointf *pIQiointf;
HRESULT hresult = CoInitialize(NULL);
CLSID clsid;
GUID guid;
hresult = CLSIDFromProgID(OLESTR("QioIntf.QioIntf.1"), &clsid);
LPOLESTR lpsz = OLESTR("{80B815FD-4DBD-11D2-8460-00A024114216}");
hresult=::CLSIDFromString(lpsz,&guid);
hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,guid, (LPVOID *)&pIQiointf);
BSTR bstrtEMP = ::SysAllocString( L"USER" );
LONG l;
hresult=pIQiointf-> QioTrySignon(bstrtEMP ,&l);
can anyone see any glaring mistakes here ... Must add that I had never looked at COM before last night and so I am probably still in supernumpty mode.
cheers
Jim
header file
class CIQiointf
{
public:
virtual HRESULT QioTrySignon(BSTR,LONG*);
};
.cpp file
CIQiointf *pIQiointf;
HRESULT hresult = CoInitialize(NULL);
CLSID clsid;
GUID guid;
hresult = CLSIDFromProgID(OLESTR("QioIntf.QioIntf.1"), &clsid);
LPOLESTR lpsz = OLESTR("{80B815FD-4DBD-11D2-8460-00A024114216}");
hresult=::CLSIDFromString(lpsz,&guid);
hresult = CoCreateInstance(clsid, NULL, CLSCTX_INPROC_SERVER,guid, (LPVOID *)&pIQiointf);
BSTR bstrtEMP = ::SysAllocString( L"USER" );
LONG l;
hresult=pIQiointf-> QioTrySignon(bstrtEMP ,&l);
can anyone see any glaring mistakes here ... Must add that I had never looked at COM before last night and so I am probably still in supernumpty mode.
cheers
Jim
Gassing Station | Computers, Gadgets & Stuff | Top of Page | What's New | My Stuff


