Hi
chiph, it is a COM program.
Ryank,
------------------------------------
GUID guid;
IDispatch* pDisp;
HRESULT hr;
hr=CLSIDFromProgID(L"x.x",&guid);
hr=CoCreateInstance(guid,NULL,CLSCTX_INPROC_SERVER,
DDI_IDispatch,&pDisp);
//do something
pDisp->Release();
////the interface pDisp is an analog of you object in VB.
-----------------------------------
Also a better way is to obtain at the first the interface IUnknown:
GUID guid;
IDispatch* pDisp;
IUnknown* pUnk;
HRESULT hr;
hr=CLSIDFromProgID(L"x.x",&guid);
hr=CoCreateInstance(guid,NULL,CLSCTX_INPROC_SERVER,
DDI_IUnknown,&pUnk);
hr=pUnk->QueryInterface(IID_IDispatch,&pDisp);
//do something
pDisp->Release();
pUnk->Release();
With interface IUnknown you can query all interfaces what the object expose.
----------------------------------
you should check on errors the hresult (hr) after each function executed.
if(FAILED(hr))
{
....
}
or
if(SUCCEDED(hr))
{
}
-------------
To begin working with COM you must call
hresult=OleInitialize(NULL);
or CoInitialize(...).
after end of COM programming call
OleUninitialize().