大网数据广告活动
Windows 系统接口

Optional Methods

· 52CE 我爱测

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).

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.

IOleClientSite

Method Comments
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

Method Comments
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

Method Comments
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)

Method Comments
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)

Method Comments
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

Method Comments
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

Method Comments
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 (because there's no guarantee that all objects are ActiveX controls; some may be regular Windows controls).

Related topics

Containers

Source: Microsoft Learn / Windows Win32 documentation by Microsoft and contributors. Documentation licensed CC BY 4.0. Code samples are covered by the MIT License. Converted from Markdown, with links normalized and embedded media omitted.

资料来源与适用范围

资料来源
Microsoft Learn / Windows Win32 documentation
适用范围
Windows Win32 API · Source date 05/31/2018
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY 4.0 (documentation), MIT (code samples)

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。