I am accessing a COM object in a .net application. I want to get the Name of this COM object supplied at the design time.
I have googled and understood that the way to get the name is through GetTypeInfo api. But I am not sure how to use it.
Can any one suggest a solution for it?
Finally, I could make this work. Following are the steps I have followed to get the name assigned to control at design time from COM object:
‘Name’ property is not directly available on IDispatch interface
Understanding Extender properties
Now, the next challenge is to get extender object from the available COM object.
Retrieving extended object is not a direct step. To achieve this,
First, we need to get pointer to IOleObject interface on the control. This can be retrieved using QueryInterface API.
Using IOleObject pointer, we have to get hold of ClientSite associated with the control. This can be achieved using GetClientSite API available on IOleObject interface. This returns a pointer to IOleClientSite interface.
From IOleClientSite interface pointer, we have to retrieve ControlSite. This is achieved by querying for IOleControlSite interface on it. This returns a pointer to IOleControlSite interface.
Extender object can be retrieved using IOleControlSite interface using GetExtendedControl API available on it.
To access Name property on extender control object, we have to get pointer to IDispatch interface and query for it.