IShellWindows::FindWindowSW method (exdisp.h)

Finds a window in the Shell windows collection and returns the window's handle and IDispatch interface.

Syntax

HRESULT FindWindowSW(
  [in]          VARIANT   *pvarLoc,
  [in]          VARIANT   *pvarLocRoot,
  [in]          int       swClass,
  [out]         long      *phwnd,
                int       swfwOptions,
  [out, retval] IDispatch **ppdispOut
);

Parameters

[in] pvarLoc

Type: VARIANT*

A VARIANT of type VT_VARIANT | VT_BYREF. Set the value of pvarLoc to an absolute PIDL (PIDLIST_ABSOLUTE) that specifies the window to find. (See remarks.)

[in] pvarLocRoot

Type: VARIANT*

Must be NULL or of type VT_EMPTY.

[in] swClass

Type: int

One or more ShellWindowTypeConstants flags that specify window types to include in the search.

[out] phwnd

Type: long*

A handle for the window matching the specified search criteria, or NULL if no such window was found.

swfwOptions

Type: int

One or more ShellWindowFindWindowOptions flags that specify search options.

[out, retval] ppdispOut

Type: IDispatch**

A reference to the window's IDispatch interface, or NULL if no such window was found.

Return value

Type: HRESULT

One of the following values, or a standard result code.

Return code Description
S_OK
A window matching the specified search criteria was found.
S_FALSE
A window matching the specified search criteria was not found.
E_NOINTERFACE
A window was found, but a reference to the window's IDispatch interface could not be obtained. Only occurs if the SWFO_NEEDDISPATCH flag is set.
E_PENDING
A window was found, but the window is pending open. Only occurs if the SWFO_INCLUDEPENDING flag is set.

Remarks

If the SWFO_COOKIEPASSED flag is set, pvarLoc is interpreted as a cookie instead of a PIDL.

Requirements

Requirement Value
Target Platform Windows
Header exdisp.h
DLL Shdocvw.dll (version 5.00.2014.0216 or later)