IAccessibilityDockingService::DockWindow method

Docks the specified window handle to the specified monitor handle.

Syntax


HRESULT DockWindow(
  [in] HWND                                 hwnd,
  [in] HMONITOR                             hMonitor,
  [in] UINT                                 uHeight,
  [in] IAccessibilityDockingServiceCallback *pCallback
);

Parameters

hwnd [in]

The accessibility application window that will be docked on the passed monitor handle.

hMonitor [in]

The monitor on which the accessibility application window will be docked.

uHeight [in]

The height at which the window will be docked, in pixels, if this function is successful. Must be less than or equal to the puMaxHeight variable retrieved from a call to the GetAvailableSize method.

pCallback [in]

The callback pointer on which the accessibility application will receive the Undock notification.

Return value

This method can return one of these values.

Return codeDescription
S_OK

Success.

E_INVALIDARG

The window handle or monitor handle is not valid.

E_ACCESSDENIED

The calling process is not a UIAcess accessibility application or the calling process does not own the window.

IMM_E_DOCKOCCUPIED

There is already another window occupying the docking space. Only one window can be docked at a time.

IMM_E_INSUFFICIENTHEIGHT

The requested uHeight is larger than the maximum allowed docking height for the specified monitor. However, if this error code is being returned, it means that this monitor does support docking, though at a height indicated by a call to the GetAvailableSize method.

HRESULT_FROM_WIN32(ERROR_INVALID_MONITOR_HANDLE)

The monitor specified by the monitor handle does not support docking.

 

Examples


class CAccessibilityApplicationWindow : public IAccessibilityDockingServiceCallback
{

    ....
    ....

    HRESULT _Dock()
    {
        IAccessibilityDockingService *pDockingService;
        HRESULT hr = CoCreateInstance(CLSID_AccessibilityDockingService,
CLSCTX_INPROV_SERVER, nullptr, IID_PPV_ARGS(&pDockingService));
        if(SUCCEEDED(hr))
        {
            UINT uMaxHeight;
            UINT uFixedWidth;
            HMONITOR hMonitor = MonitorFromWindow(_hwndMyApplication,
MONITOR_DEFAULTTONULL);
            if (hMonitor != nullptr)
            {
                hr = pDockingService->GetAvailableSize(hMonitor, &uMaxHeight,
uMaxHeight, this)
                }
            }
        }
    }
}

Requirements

Header

Shobjidl.h

See also

IAccessibilityDockingService

 

 

Show: