Share via


IMessengerWindow::Close

This content is no longer actively maintained. It is provided as is, for anyone who may still be using these technologies, with no warranties or claims of accuracy with regard to the most recent product version or service release.

Closes a messenger window. If the window is a conversation window, this method terminates any sessions contained in it. Not scriptable.

Syntax

HRESULT Close(
);

Parameters

This method takes no parameters.

Return Value

Returns one of the following values. For managed code applications, these return values are received in the form of a COMException.

  • S_OK
    Success.
  • E_FAIL
    Cannot get a window handle.

Remarks

Windows that are being closed while some actions are still in progress can return confirmation dialog boxes to the user, which hangs up the application until the user responds.

Closing the main application window effectively places it into the tray. The object is still active and maintains a process, but it does not appear on the taskbar. Closing a conversation window essentially dereferences it. Further IMessengerConversationWnd interface calls against that window are invalid because the window and its internal object have been completely removed and not just hidden from the client. After a conversation window is closed, any pointers to it should be cleaned up.

Example

In the following sample, messageWindow is an object implementation of the IMessengerWindow interface. The sample closes the UI to the system tray if it is open.

IMessengerWindow messengerWindow = (IMessengerWindow)communicator.Window;
try
{
   messengerWindow.Close();
}
catch (COMException CME)
{
   Console.WriteLine(CME.ErrorCode.ToString());
}

Requirements

  • Client
    Requires Microsoft DirectX 9.0, C Runtime libraries (msvcm80.dll) on Microsoft Windows© Vista, Microsoft Windows XP Service Pack 1 (SP1) or later, or Microsoft Windows 2000 with Service Pack 4 (SP4). Any Communicator-imposed restrictions apply. .
  • Server
    Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.
  • Product
    Microsoft Office Communicator 2007 Automation API
  • IDL file
    Msgrua.idl

See Also

Reference

IMessengerWindow::IsClosed