Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

IUnknown_GetWindow function

Attempts to retrieve a window handle from a Component Object Model (COM) object by querying for various interfaces that have a GetWindow method.

Syntax


HRESULT IUnknown_GetWindow(
  _In_   IUnknown *punk,
  _Out_  HWND *phwnd
);

Parameters

punk [in]

Type: IUnknown*

A pointer to the COM object from which this function will attempt to obtain a window handle.

phwnd [out]

Type: HWND*

A pointer to a HWND that, when this function returns successfully, receives the window handle. If a window handle was not obtained, this parameter is set to NULL.

Return value

Type: HRESULT

Returns S_OK if a window handle was successfully returned, or a COM error code otherwise. If no suitable interface was found, the function returns E_NOINTERFACE. Otherwise, the function returns the HRESULT returned by the corresponding interface's GetWindow method.

Remarks

This function attempts to retrieve the window handle by calling IOleWindow::GetWindow, IInternetSecurityMgrSite::GetWindow, and IShellView::GetWindow. It is possible that future versions of IUnknown_GetWindow may attempt additional interfaces.

Note  The query for IShellView is theoretically unnecessary because IShellView derives from IOleWindow. The function explicitly queries for this interface because some objects implement QueryInterface incorrectly and fail to respond to a query for the base interface.

Requirements

Minimum supported client

Windows 2000 Professional, Windows XP [desktop apps only]

Minimum supported server

Windows 2000 Server, Windows Server 2003 [desktop apps only]

Header

Shlwapi.h

DLL

Shlwapi.dll (version 5.0 or later)

 

 

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.