How Do I Get an Interface Pointer To a Control?

Given only the handle of a host window, you can get the IUnknown interface pointer of the hosted control by calling AtlAxGetControl. You can query that pointer for any interface supported by that control.

If you have the control ID of the control's host window and a CWindow-derived wrapper for its parent window (for example, you are using the CAxDialogImpl or CComCompositeControl classes), you can get an interface on the ActiveX control by calling CWindow::GetDlgControl.

If you have a CAxWindow object, you can get an interface on the ActiveX control by calling CAxWindow::QueryControl.

ATL Control Containment FAQ