Dock [v2.0 b3]

Author: majkinetor Last Modified: nonexistent


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.

Dock(pClientID, pDockDef="", reset=0)
Dock_HookProc(hWinEventHook, event, hwnd, idObject, idChild, dwEventThread, dwmsEventTime )
Dock_Shutdown()
Dock_Toggle(false)
Dock_Update()

For the functions's parameters and return value, please see it's source code or the document.

Remarks

Its not strictly stdlib conform, because it works with global variables AND have subroutines with Return statements. If you want to use this library, you must include at the end of your script after last Return (end of AutoExec).

See at DockA for regular AutoHotkey Guis:
* GUID=ed633b80-ac75-126a-97c9-1634b021e32f

For update's details and remarks related to the functions, please see the AutoHotkey Forum: http://www.autohotkey.com/forum/viewtopic.php?t=19400

License

The functions is an open source item under the CC By-Nc 3.0 license.
For details, please see http://creativecommons.org/licenses/by-nc/3.0/

Example

; #Include Dock.ahk
SetBatchLines, -1 
#SingleInstance, force 
   
   Msgbox This test will monitor Notepad appearance and add customizable number of dock clients to its left side.

   host := "ahk_class Notepad" 
   clientNo := 5 


   loop, %clientNo% 
   { 
      Gui %A_Index%:+LastFound +ToolWindow +Border +Resize -Caption 
      Gui,%A_Index%:Add, Button, 0x8000, %A_Index% 
      c%A_Index% := WinExist() 

      Dock("+" c%A_Index%, "0,-1,-10, 0,0," A_Index*50 ",0,50,0,50") 
   } 

   Dock_OnHostDeath := "OnHostDeath" 

return 

FindHost: 
   if Dock_HostID := WinExist(host) 
   { 
      SetTimer, FindHost, OFF 
       loop, %clientNo% 
         DllCall("ShowWindow", "uint", c%A_Index%, "uint", 5)     
       
      Dock_Toggle(true) 
   } 
return 

OnHostDeath: 
   SetTimer, FindHost, 100 
return