Search code examples
com

How to determine ActiveX control interface has function in client application


We are using a 3rd party ActiveX control in our application, recently as per our request they have added new function in ActiveX control interface and we are trying to access those function in our application. Due to some reason there are chances where we can not deploy our 3rd party ActiveX control but we are deploying our application. So old 3rd party ActiveX does not have new functions but our application which is consuming those function are trying access new function. Because of that we are getting some inconsistent behaviour lIke crash or message error box. So we wanted to understand that is there any way to determine function of 3rd party ActiveX control exist or not in our application ? So based on that we wanted to avoid calling those function. Thanks.


Solution

  • Well, you can get the type library information and try to read and walk it to determine if the function exists.

    Or, you can call the function through IDispatch::Invoke and see if it fails. If it fails, don't call it again and call the fallback function.

    So, it doesn't have a separate Guid for the two different interfaces? Technically, it is supposed to...but sometimes vendors don't provide new Guids for updated interfaces....I plead the 5th.

    The way it is supposed to work is the you QueryInterface for the interface you want and use it.