C ++ COM interface method access
AND
- CLSID
- IID
By specifying the above and using:
- CoCreateInstance ()
Return a single uninitialized object of the class specified above CLSID.
How can I access an interface method from C ++? Without:
- ATL
- MFC
- Just C ++
Subsequently I use CreateInstance ()
I'm having trouble using CreateInstance () - with the last parameter - ppv
Using oleview I can see methods of the above IIDabove IID like:
interface IS8Simulation : IDispatch {
HRESULT Open([in] BSTR FileName);
};
How can I access the above? Examples / guide - please
Hello
source to share
By doing CoCreateInstance, you get a pointer to the interface. With the QueryInterface (...) method, you can easily get a pointer to the interface of another interface. eg.,
<code> IUnknown * pUnk = NULL; HRESULT hr = :: CoCreateInstance (clsid, NULL, CLSCTX_ALL, __ uuidof (IUnknown), (void **) and pUnk);
IS8Simulation * pSim = NULL; hr = pUnk-> QueryInterface (__ uuidof (IS8Simulation), (void **) & pSim);
Code>
After that, you will get a pointer to IS8Simulation in pSim and through it you can call the methods of this interface. Remember, you need to provide a valid clsid in the call to CoCreateInstance.
source to share