Retrieves a window handle to a messenger window. Not scriptable.
Syntax
HRESULT HWND( [out, retval] long* phWnd ); |
Parameters
- phWnd
-
Pointer to a LONG that receives a HWND handle to this messenger window.
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.
- RPC_X_NULL_REF_POINTER
-
phWnd is a null pointer.
- E_FAIL
-
Cannot get a window handle.
- E_NOTIMPL
-
The property cannot be accessed through scripting.
Remarks
Unlike the Messenger application, there can be more than one conversation window and therefore more than one HWND. Each individual conversation window handle (HWND) is retrieved by querying the specified conversation window HWND property.
If called on the IMessengerWindow interface of the application's messenger window, it returns a HWND for the messenger window instantiated by the parent application.
Example
The code example uses a previously instantiated Messenger interface object called communicator to retrieve the window handle from the IMessenger::Window property. The window handle is displayed in a console window if it is retrieved without error. In the event of an error, the communicator object raises a COM exception that is caught and displayed in the console window.
Copy Code | |
---|---|
if (communicator != null) { IMessengerWindow messengerWindow; try { messengerWindow = (IMessengerWindow)communicator.Window; Console.WriteLine("Messenger Window: " + messengerWindow.HWND.ToString()); } catch (COMException GWCE) { Console.WriteLine(GWCE.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