IAccessibilityDockingService::DockWindow method

Docks an accessibility app window to the bottom of a screen while the system is in a full-screen or filled mode.

Syntax


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

Parameters

hwnd [in]

Type: HWND

The handle of the accessibility app window to dock on the monitor.

hMonitor [in]

Type: HMONITOR

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

cyRequested [in]

Type: UINT

The requested height, in physical pixels, of the docked window. This must be less than or equal to the pcyMax value retrieved through GetAvailableSize).

pCallback [in]

Type: IAccessibilityDockingServiceCallback*

A callback method pointer through which the accessibility app can receive a notification when the docked window is undocked.

Return value

Type: HRESULT

This method can return one of these values.

Return codeDescription
S_OK

The method succeeded.

E_INVALIDARG

The window handle or monitor handle is not valid.

E_ACCESSDENIED

The calling process is not a UIAccess accessibility app 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 height requested in cyRequested is larger than the maximum allowed docking height for the specified monitor. Note that if this error code is returned, it means that this monitor supports docking, though for a window of less height. Call GetAvailableSize to determine the maximum value for cyRequested.

HRESULT_FROM_WIN32(ERROR_INVALID_MONITOR_HANDLE)

The monitor specified by hMonitor does not support docking.

 

Remarks

This function will dock the specified window to the specified monitor. The window's new width will be the current width of the monitor. The window's new height will be cyRequested if it is less than the maximum available docking height for the monitor.

Examples

The following example shows the use of DockWindow. The method first calls GetAvailableSize to determine the maximum height of the docked window.



 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, &uFixedWidth);
                 if (SUCCEEDED(hr))
                 {
                     hr = pDockingService->DockWindow(_hwndMyApplication, hMonitor, uMaxHeight, this)
                 }
             }
         }
     }
 }

Requirements

Minimum supported client

Windows 8 [desktop apps only]

Minimum supported server

Windows Server 2012 [desktop apps only]

Header

Shobjidl.h

IDL

Shobjidl.idl

See also

IAccessibilityDockingService

 

 

Community Additions

ADD
Show:
© 2014 Microsoft. All rights reserved.