IOleObject::Close method (oleidl.h)
Changes an embedded object from the running to the loaded state. Disconnects a linked object from its link source.
Syntax
HRESULT Close(
[in] DWORD dwSaveOption
);
Parameters
[in] dwSaveOption
Indicates whether the object is to be saved as part of the transition to the loaded state. Valid values are taken from the enumeration OLECLOSE.
Return value
This method returns S_OK on success. Other possible return values include the following.
Return code | Description |
---|---|
|
The user was prompted to save but chose the Cancel button from the prompt message box. |
Remarks
Notes to Callers
A container application calls IOleObject::Close when it wants to move the object from a running to a loaded state. Following such a call, the object still appears in its container but is not open for editing. Calling IOleObject::Close on an object that is loaded but not running has no effect. Closing a linked object simply means disconnecting it.Notes to Implementers
Upon receiving a call to IOleObject::Close, a running object should do the following:- If the object has been changed since it was last opened for editing, it should request to be saved, or not, according to instructions specified in dwSaveOption. If the option is to save the object, then it should call its container's IOleClientSite::SaveObject interface.
- If the object has IDataObject::DAdvise connections with ADVF_DATAONSTOP flags, then it should send an IAdviseSink::OnDataChange notification. See IDataObject::DAdvise for details.
- If the object currently owns the Clipboard, it should empty it by calling OleFlushClipboard.
- If the object is currently visible, notify its container by calling IOleClientSite::OnShowWindow with the fshow argument set to FALSE.
- Send IAdviseSink::OnClose notifications to appropriate advise sinks.
- Finally, forcibly cut off all remoting clients by calling CoDisconnectObject.
Calling IOleObject::Close on a linked object disconnects it from, but does not shut down, its source application. A source application that is visible to the user when the object is closed remains visible and running after the disconnection and does not send an IAdviseSink::OnClose notification to the link container.
Requirements
Requirement | Value |
---|---|
Minimum supported client | Windows 2000 Professional [desktop apps only] |
Minimum supported server | Windows 2000 Server [desktop apps only] |
Target Platform | Windows |
Header | oleidl.h |