C ++ ATL Member Variable Access Help
I am not familiar with this and can use the starting strike.
I am using an ATL custom control (unmanaged C ++) and would like to use a ShockWave ActiveX object. I need to know how to declare it so that I can set a property or call a method.
For example, if I could assign a variable to it, I would like to call "variable-> LoadMovie ()"
I know it's super funny ... almost embarrassing to ask about it here.;) (Almost)
source to share
If you #import dll (which I recommend when working with COM because it makes your life so much easier), you can use a smart pointer paired with the CLSID of the object. Remember that the smart pointer classes have "Ptr" after the interface name after you fix them.
For example:
ISomeInterfacePtr pSomeInterface( CLSID_SomeComponent );
HRESULT hr = pSomeInterface->SomeMethod();
Hope it helps.
EDIT: If you want to check the HRESULT for an allocation, you can do the following:
ISomeInterfacePtr pSomeInterface = 0;
HRESULT hr = pSomeInterface.CreateInstance( CLSID_SomeComponent );
source to share
I cut and paste the required code so many times that I can't remember the exact syntax, but you need:
get CComPtr <> of the correct interface, CreateInstance a QueryInterface object to get the required interface (if you are not using CComPtr)
then call methods on it.
Alternatively you can #import dll, then the compiler will generate C ++ class with all methods and properties for you.
source to share