Επεξεργασία

Share via


IShellWindows interface (exdisp.h)

Provides access to the collection of open Shell windows.

Inheritance

The IShellWindows interface inherits from the IDispatch interface. IShellWindows also has these types of members:

Methods

The IShellWindows interface has these methods.

 
IShellWindows::_NewEnum

Retrieves an enumerator for the collection of Shell windows.
IShellWindows::FindWindowSW

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

Gets the number of windows in the Shell windows collection.
IShellWindows::Item

Returns the registered Shell window for a specified index.
IShellWindows::OnActivated

Occurs when a Shell window's activation state changes.
IShellWindows::OnCreated

Occurs when a new Shell window is created for a frame.
IShellWindows::OnNavigate

Occurs when a Shell window is navigated to a new location.
IShellWindows::ProcessAttachDetach

Deprecated. Always returns S_OK.
IShellWindows::Register

Registers an open window as a Shell window; the window is specified by handle.
IShellWindows::RegisterPending

Registers a pending window as a Shell window; the window is specified by an absolute PIDL.
IShellWindows::Revoke

Revokes a Shell window's registration and removes the window from the Shell windows collection.

Remarks

A Shell window is a window that has been registered by calling IShellWindows::Register or IShellWindows::RegisterPending. Upon registration, the specified window is added to the collection of Shell windows, and granted a cookie that uniquely identifies the window within the collection. A window can be un-registered by calling IShellWindows::Revoke.

The Shell windows collection includes file explorer windows and web browser windows Internet Explorer and 3rd-party web browsers). Normally each Shell window implements IDispatch; IShellWindows::Item and IShellWindows::FindWindowSW provide ways to access a Shell window's IDispatch interface. For more information, see Dispatch Interface and Automation Functions.

IID IID_IShellWindows (85CB6900-4D95-11CF-960C-0080C7F4EE85)
CLSID CLSID_ShellWindows (9BA05972-F6A8-11CF-A442-00A0C90A8F39)
 

The following example shows how to retrieve an IShellWindows instance.

#include "exdisp.h"
                
...

IShellWindows *psw;
HRESULT hr;

hr = CoInitialize(NULL);
if (SUCCEEDED(hr))
{
    hr = CoCreateInstance(
        CLSID_ShellWindows,
        NULL,
        CLSCTX_ALL,
        IID_IShellWindows,
        (void**)&psw
    );
    
    if (SUCCEEDED(hr))
    {
        // Use the IShellWindows instance...
        
        psw->Release();
    }
}

Requirements

Requirement Value
Target Platform Windows
Header exdisp.h

See also

CoCreateInstance

CoInitialize

DShellWindowsEvents

IDispatch

ShellWindows