Dock desired top level windows (dock clients) to any top level window (dock host)


Using dock module you can glue your or third-party windows to any top level window.  Docked windows in module terminology are called Clients and the window that keeps their position relative to itself is called Host.  Once Clients are connected to the Host, this group of windows will behave like single window - moving, sizing, focusing, hiding and other OS events will be handled by the module so that the “composite window” behaves like the single window.

Module uses system hook to monitor windows changes, so it’s idle when it is not arranging windows.

DockDock desired top level windows (dock clients) to any top level window (dock host)
DockInstantiate dock of given client upon host.
Dock_ShutdownUninitialize dock module.
Dock_ToggleToggles the dock module ON or OFF.
PresetsThis section contains some common docking setups.


pDockDef = "",
reset = 0)

Instantiate dock of given client upon host.  Multiple clients per one host are supported.


pClientIdHWND of the Client GUI.  Dock is created or updated (if already exists) for that hwnd.
pDockDefDock definition, see bellow.  To remove dock client pass “-”.  If you pass empty string, client will be docked to the host according to its current position relative to the host.
resetinternal parameter, do not use.


Dock_HostIDSets docking host
Dock_OnHostDeathSets label that will be called when host dies.  Afterwards, module will disable itself using Dock_Toggle(false).

Dock definition

Dock definition is string containing unordered white space separated parameters which describe Client’s position relative to the Host.  The big number of parameters allow for fine tuning of Client’s position and basically every setup is possible.  Parameters are grouped into 4 classes - x, y, w & h parameters.  Classes and their parameters are optional.

      Syntax:     x(hw,cw,dx)  y(hh,ch,dy)  w(hw,dw)  h(hh,dh)  t
  • The X coordinate of the top, left corner of the client window is computed as HostX + hw*HostWidth + cw*ClientWidth + dx, with the parameters hw, cw & dx (shorten from host width and client width multipliers, delta x).
  • The Y coordinate of the top, left corner of the client window is computed as HostY + hh*HostHeight + ch*ClientHeight + dy, with the parameters hh, ch and dy.
  • The width W of the client window is computed as hw*HostWidth + dw, with the parameters hw & wd.
  • The height H of the client window is computed as hh*HostHeight + dh, with the parameters hh & hd.
  • The topmost state of the client is T.  Specify this option to to set the Client always on top the Host.  This allows client to be positioned inside the Host.

If you omit any of the class parameters it will default to 0.  So, the following expressions all have the same effect :

          x(0,0,0) = x(0,0) = x(0,0,) = x(0) = x(0,)= x(0,,) = x() = x(0,,0) = x(,0,0) = x(,,0) = ...
          y(0,1,0) = y(0,1) = y(,1) = y(,1,) = y(,1,0) = ...

Keep in mind that x() is not the same as omitting x entirely.  First case is equal to x(0,0,0) so it will set Client’s X coordinate to be equal as Host’s.  In second case, x coordinate of the client will not be touched by the Dock module but Client will keep whatever x it had before.


”OK” or “Err” with text describing last successful or failed action.


You must set DetectHiddenWindows if Host is practicing hiding.  Otherwise, Dock will treat Host hiding as death.  All clients will be hidden once host is terminated or it becomes hidden itself.

Use SetBatchLines, -1 with dock module for fluid client movement.  You will experience delay in clients moving otherwise.  However, if CPU usage is very high, you might experience a delay in client movement anyway.

If you are using Gui, Show command immediately before registering client, make sure you specify NoActivate flag.

”Topmost” feature can be used to create additional caption buttons.  Caption buttons are topmost clients containing only 1 button and docked to the Host so that they appear in its caption.  To setup caption button, only X class is needed.  For instance “x(1,0,-100)” can be used to set caption button 100 pixels from the right edge of the Host’s caption.


Dock(Client1ID, "x(0,-1,-10)  y(0,0,0)  w(0,63)  h(1,0)")   ;top left, host height
Dock(Client2ID, "x() y(,-1,-5) w(1)  h(,30)")               ;top above, host width, short definition
Dock(hTitleBtn, "x(1,0,-80), y(0,0,5) w(0,20) h(0,15) t")   ;add title button, topmost client docked inside Host, on title, with 20x15 size



Uninitialize dock module.  This will clear all clients and internal data and unregister hooks.  Dock_OnHostDeath, Dock_HostId are kept on user values.


Dock_Toggle(enable = "")

Toggles the dock module ON or OFF.


enableSet to true to set the dock ON, set to FALSE to turn it OFF.  Skip to toggle.


Use Dock_Toggle(false) to suspend the dock module (to unregister hook), leaving its internal data in place.  This is different from Dock_Shutdown as latest removes module completely from memory and unregisters its clients.

You can also use this function to temporary disable module when you don’t want dock update routine to interrupt your time critical sections.


This section contains some common docking setups.  You can just copy/paste dock definition strings in your script.

x(,-1) y()top left, own size
x(,-1,10) y()top left, own size, 10px padding
x(,-1) y() h(1)top left, use host’s height, keep own width
x(,-1,20) y() w(,50) h(1)top left, use host’s height, set width to 50 and padding to 20px
x(,-1) y(.5,-.5)middle left, keep own size
x(,-1) y(1,-1) w(,20) h(,20)bottom left, fixed width & height to 20px
x(,-1) y(1,-1) h(.5)bottom left, keep height half of the Host’s height, keep own width
x(1,-1) y(1) w(.25) h(.25)bottom right, width and height 1/5 of the Host
x() y(1) w(1) h(,100)below the host, use host’s width, height = 100
x() y(,-1,-5) w(1)above the host, use host’s width, keep own height, 5px padding
x(.5,-.5) y(,-1) w(,200) h(,30)center above the host, width=200, height=30
x(.5,-.5) y(1) w(0.3) h(,30)center bellow the host, use 1/3 Host’s width, height=30
x(1) y()top right, own size
x(1) y() w(,40) h(1)top right, use host’s height, width = 40
x(1) y(.5,-.5)middle right, keep own size


pDockDef = "",
reset = 0)
Instantiate dock of given client upon host.
Uninitialize dock module.
Dock_Toggle(enable = "")
Toggles the dock module ON or OFF.