# Optional Methods

An OLE component can implement an interface without implementing all the semantics of every method in the interface, instead returning E_NOTIMPL or S_OK as appropriate. The following table describes those methods that an ActiveX Control container is not required to implement (i.e. the control container can return E_NOTIMPL).

The table below describes optional methods; note that the method must still exist, but can simply return E_NOTIMPL instead of implementing real semantics. Note that any method from a mandatory interface that is not listed below must be considered mandatory and may not return E_NOTIMPL.

Method | Comments
IOleClientSite |
SaveObject | Necessary for persistence to be successfully supported.
GetMoniker | Necessary only if the container supports linking to controls within its own form or document.
IOleInPlaceSite |
ContextSensitiveHelp | Optional
Scroll | May return S_FALSE with no action.
DiscardUndoState | Can return S_OK with no action.
DeactivateAndUndo | Deactivation is mandatory; Undo is optional.
IOleControlSite |
GetExtendedControl | Necessary for containers that support extended controls.
ShowPropertyFrame | Necessary for containers that wish to include their own property pages to handle extended control properties in addition to those provided by a control.
TranslateAccelerator | May return S_FALSE with no action.
LockInPlaceActive | Optional
IDispatch (Ambient properties) |
GetTypeInfoCount | Necessary for containers that support non-standard ambient properties.
GetTypeInfo | Necessary for containers that support non-standard ambient properties.
GetIDsOfNames | Necessary for containers that support non-standard ambient properties.
IDispatch (Event sink) |
GetTypeInfoCount | The control knows its own type information, so it has no need to call this.
GetTypeInfo | The control knows its own type information, so it has no need to call this.
GetIDsOfNames | The control knows its own type information, so it has no need to call this.
IOleInPlaceFrame |
ContextSensitiveHelp |
GetBorder | Necessary for containers with toolbar UI (which is optional)
RequestBorderSpace | Necessary for containers with toolbar UI (which is optional)
SetBorderSpace | Necessary for containers with toolbar UI (which is optional)
InsertMenus | Necessary for containers with menu UI (which is optional)
SetMenu | Necessary for containers with menu UI (which is optional)
RemoveMenus | Necessary for containers with menu UI (which is optional)
SetStatusText | Necessary only for containers that have a status line
EnableModeless | Optional
TranslateAccelerator | Optional
IOleContainer |
ParseDisplayName | Only if linking to controls or other embeddings in the container is supported, as this is necessary for moniker binding.
LockContainer | As for ParseDisplayName
EnumObjects | Returns all ActiveX Controls through an enumerator with IEnumUnknown, but not necessarily all objects (since there’s no guarantee that all objects are ActiveX Controls; some may be regular Windows controls).