Retrieves a Boolean value that indicates the open or closed state of the window. Scriptable.


   retval] VARIANT_BOOL* pBoolClose



Pointer to a VARIANT_BOOL that defines the open and closed state for the messenger window with one of the following possible values in the following table.


The Office Communicator UI window is closed. This means that it has no HWND or window handle either numerically or on a system level. Attempts to reference some functions in the Microsoft® Win32® API against the window fails. The client can continue to exist as a running executable and can potentially be seen in process lists and in minimized form in the notification area or system tray.


The application window is either visible or minimized and has a valid HWND or window handle.

Return Value

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




pBoolClose is a null pointer.


The conversation window on which this method is called is an IMessengerConversationWnd object and is closed but not released.


This method is useful when this interface is called against the application window. The method can be called against a conversation window, but returns false for any case in which a valid MessengerWindow object existed to call the method against. If the conversation window that corresponds to the object is closed by client action, a COMExeption E_FAIL is raised.

When the user closes a conversation window, Office Communicator Automation API raises an DMessengerEvents::OnIMWindowDestroyed event. It is a good practice to make the event handler release the IMessengerConversationWnd representing the conversation using the following syntax where pIMWindow is the argument passed to the event handler.

Copy Code

When the conversation window is released using this code, any references to it raises a NULLException error.

Calling IsClosed on the Office Communicator window itself returns true or false. A minimized window is considered to be closed or not closed based on the visibility settings through Show, Close, or equivalent UI settings.


The following code example reads the IsClosed property of the ImessengerWindow interface object messengerWindow. If the Office Communicator UI window is open or minimized, the code writes "Window is Open" to the console window. If the Office Communicator UI window is closed to the system tray, the code writes "Window is Closed" to the console window.

If the messengerWindow object is an IM window rather than an application window, the object raises an exception that is caught by the code. The exception error code is written to the console window.

Copy Code
   if (messengerWindow.IsClosed == true)
	 Console.WriteLine("Window is closed");
	 Console.WriteLine("Window is Open");
 catch (COMException CMIC)



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


Requires Microsoft Office Communications Server 2007, AV MCU (for Media Support), Media Relay (for NAT/Firewall traversal) on Microsoft Office Communications Server 2007.


Microsoft Office Communicator 2007 Automation API

IDL file


See Also