Convert between a Windows handle and a Window Id (pseudo-handle)
cWinIdConvert(window-id | window-handle)
(s/i) window-id or window-handle Window ID handle or Window handle.
(s/i) window-id or window-handle Window handle, if parameter is a Window ID or Window ID, if parameter is a window handle.
You can use CWinIdConvert to convert between a Windows handle and a Window Id (pseudo-handle). If you pass in a Windows handle, the function returns the corresponding Window ID. Conversely, if you pass in a Window ID, the function returns the corresponding Window handle.
CWinIdConvert will error if the input value does not reference an existing window.
;***************************************
;** Convert from win-ID to win-handle **
;***************************************
AddExtender("wwctl44i.dll",0,"wwctl64i.dll") ; Get notepad’s Edit control. Run("notepad.exe", "My.txt") WinId = WinIdGet("~Notepad") hWnd = cWinIDConvert(WinId) hEdit = cWndbyclass(hWnd, "Edit") ; Get the text from NotePad. sMyText = cGetEditText(hEdit) ; Start another notepad. Run("notepad.exe", "") WinId = WinIdGet("~Notepad") hWnd = cWinIDConvert(WinId) hEdit = cWndbyclass(hWnd, "Edit") ; Move the text to the second NotePad cSetEditText(hEdit, sMyText) Exit
;***************************************
;** Convert from win-handle to win-ID **
;***************************************
AddExtender("wwctl44i.dll",0,"wwctl64i.dll")
; Get notepad's Edit control. Run("notepad.exe", "My.txt") WinId = WinIdGet("~Notepad") hWnd = cWinIDConvert(WinId) hEdit = cWndbyclass(hWnd, "Edit") ; Get the text from NotePad. sMyText = cGetEditText(hEdit) ; Start another notepad. Run("notepad.exe", "") WinId = WinIdGet("~Notepad") hWnd = cWinIDConvert(WinId) hEdit = cWndbyclass(hWnd, "Edit") ; Move the text to the second NotePad cSetEditText(hEdit, sMyText) ; Launch toe Save file dialog. SendMenusTo(WinId, "File Save As") WinWaitExist("Save As", 8) ; Get file name edit window id. hWndDialog = cWndbyname(0,"Save As") hEdit = cWndbyclass(hWndDialog, "Edit") EditId = cWinIDConvert(hEdit) ; Give the file a name and press the save button. SendKeysTo(EditId, "New File.txt") hButton = cWndbyname(hWndDialog, "Save~") cPostButton( hButton ) Exit
WinIdGet, DllHwnd, WinItemNameId (See WIL help file for documentation of these functions)