Providing Support for Subclassing

An application can support subclassing through the IASClassMsgSink interface. The IASClassMsgSink interface contains all the IASControl methods necessary to duplicate the messaging and drawing capabilities of an IASControl, for example handling keystrokes. By subclassing the IASControl::KeyPress method of a form or control, the keystroke message can be handled by the application’s IASClassMsgSink::HandleKeyPress method. ActiveX does not provide for run time inheritance from existing controls. A pointer to the default IASClassMsgSink interface is stored in the control’s ClassMsgSink property.

An application can verify if subclassing is supported by invoking IASControl::get_ClassMsgSink. Controls that do not support subclassing return E_NOTIMPL when this method or the corresponding put method is invoked.

If a class message sink is implemented, the associated IASControl methods should immediately pass the necessary data to a IASClassMsgSink equivalent. If no further processing is needed, the IASClassMsgSink method returns S_OK. If the method returns S_FALSE, the control should perform default processing.