Επεξεργασία

Κοινή χρήση μέσω


IUnknown_GetWindow function (shlwapi.h)

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

Syntax

LWSTDAPI IUnknown_GetWindow(
  [in]  IUnknown *punk,
  [out] HWND     *phwnd
);

Parameters

[in] punk

Type: IUnknown*

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

[out] phwnd

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

Requirement Value
Minimum supported client Windows 2000 Professional, Windows XP [desktop apps only]
Minimum supported server Windows 2000 Server, Windows Server 2003 [desktop apps only]
Target Platform Windows
Header shlwapi.h
DLL Shlwapi.dll (version 5.0 or later)