Sets the visibility status of a messenger window. Scriptable.




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.


Success. The window might already have been in that visibility state, in which case no separate code is returned.


The window instance is destroyed.


This method is generally called in cases in which the IMessengerWindow::IsClosed method returns true. Calling the IMessengerWindow::Show method redisplays the application window or a conversation window, depending on the type of window to which the MessengerWindow object corresponds.

If the last state of the window is minimized by user action, the window becomes both visible and drawn to the last default sizing. If the last state of the window is minimized by user action, the window becomes both visible and drawn to the last default sizing. A minimized window is the only scenario in which calling IMessengerWindow::Show on a conversation rather than main application window is useful. If the conversation window was previously closed, the object itself would have disappeared. Calling the IMessengerWindow::Show method, or at least verifying that IMessengerWindow::IsClosed method does not return true, is a prerequisite to calling a number of other automation interfaces that require a valid window handle. For example, calling the IMessengerWindow::Left property while the window is closed returns E_FAIL as the HRESULT. The visibility of the application window is not parallel to the Visible properties and methods implemented in other application automation interfaces, such as Office Communicator Automation API. When the application window is closed, it is not just sent and processed in the background. A closed application is sent to the background both internally as a process and visually in terms of its graphical display.


The following code first verifies that a valid window handle exists for the messengerWindow object in question by reading the HWND property of the object. If the messengerWindow object no longer exists, a COMException is raised and code execution is immediately transferred to the outer catch structure.

If a valid window handle is returned, the code reads the IsClosed property to determine the status of the window. If the messenger window is closed, the code reopens the window by calling the Show method on the messengerWindow object.

Copy Code
int messengerWindowHWND; 
  messengerWindowHWND = messengerWindow.HWND;
  If (messengerWindow.IsClosed == true)
	 catch (COMException CMES)

Catch (COMexception CE)
   Console.WriteLine("Could not get a messenger window handle:" + CE.ErrorCode.ToString());



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