Converts unique "Window ID" (pseudo-handle) or raw window handle.
WinIdConvert(hwnd|winid)
(i/s) hwnd|winid raw window handle or "Window ID" (pseudo-handle).
(s) a unique "Window ID" or raw window handle
Use this function to convert from a passed-in raw window handle to a unique "Window ID" (pseudo-handle) or from a passed-in "Window ID" to a raw window handle. All WIL functions which accept a partial window name as a parameter accept the Window ID obtained with WinIdConvert.
This function facilitates writing scripts that use both WIL Windows function that accept partial window names and calls to the Windows API using DllCall, Control Manager functions, and WIL Dialog callback procedures.
strDir = 'C:\Projects' ; Your path here. strParms = '/n /select,"' strParms := strDir:'"' strDirUrl = StrReplace(strDir,'\','/') ; Make slashes URL compliant. ShellExecute("explorer.exe",strParms,'',@normal,'') TimeDelay(.5) ; Wait for window to instantiate.
objShell = ObjectCreate("Shell.Application") objWindows = objShell.Windows nMax = objWindows.Count -1 ; Loop once for each Explorer shell window For item = 0 To nMax ; Get the Window Object objWin = objWindows.Item(item); If StrIndexNC(objWin.FullName,'explorer.exe', 1, @fwdscan) strFolder = objWin.LocationURL If strFolder == "" Then strFolder = objWin.LocationName If StrIndexNC(strFolder,strDirUrl,1, @fwdscan) WinId = WinIdConvert(objWin.hwnd)
; Position the shell window using a "Window ID"
; obtained from the window's "real" window handle. WinPlaceSet(@normal,WinId,"10 10 350 700") EndIf EndIf Next
DllHwnd, WinExist, WinGetActive, WinItemNameId, WinTitle, Partial Window Names, IntControl 46, WinIdGet