WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Control Manager
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Error 257 Specified Window Not Found

 Keywords: Error 257 Specified Window Not Found cSetFocus 

Question:

I keep WIL extender error: 257 specified window not found.
cSetFocus(ControlHandle)
This is exactly what the pop up window says. This code is auto generated by roboscripter, I did not change anything.

Answer:

Roboscripter does much of the heavy lifting however you will still need to add additional code to handle for possible delays and errors.

Make sure you add some code after the Run statement to confirm the parent window exists before continuing. I recommend using WinWaitExist or TimeDelay.

Also I prefer to use the DllHwnd instead of the cWndByWndSpec, just in case the window specification changes with each instance of the application.

Here is some revised code that should help you move forward.

AddExtender("wwctl44i.dll")

partialwinname = 'Login'


;Launch Program
Run("C:\Program Files (x86)\Fleet Maintenance Pro\FMP.EXE","")

ret = WinWaitExist(partialwinname, 10)
If ret == 0
   Pause('Notice','Make sure application window is on the screen')
   Exit
EndIf

ControlHandle=DllHwnd('Login')
cSetFocus(ControlHandle)  ; Activates Window


; Set focus and send keys to a TcxCustomInnerTextEdit Control
window1=DllHwnd('Login')
window2=cWndbyid(window1,3606200)
; or window2=cWndBySeq(window1,4)
ControlHandle=cWndbyclass(window2,`TcxCustomInnerTextEdit`)
; or ControlHandle=cWndBySeq(window2,1)
If ControlHandle == 0
   Pause('Notice','Unable to set focus on first control')
   Exit
EndIf
cSetFocus(ControlHandle)  ; Activates Window
TimeDelay(1)
SendKey(`IMS`)     ;Sends Keystrokes


; Set focus and send keys to another TcxCustomInnerTextEdit Control
window1=DllHwnd('Login')
window2=cWndbyid(window1,5441068)
; or window2=cWndBySeq(window1,3)
; ControlHandle=cWndByID(window2,2163758)
ControlHandle=cWndbyclass(window2,`TcxCustomInnerTextEdit`)
; or ControlHandle=cWndBySeq(window2,1)
If ControlHandle == 0
   Pause('Notice','Unable to set focus on second control')
   Exit
EndIf
cSetFocus(ControlHandle)  ; Activates Window
TimeDelay(1)
SendKey(`imsuser`)     ;Sends Keystrokes


Article ID:   W17559
Filename:   Error 257 Specified Window Not Found.txt
File Created: 2012:10:25:10:09:42
Last Updated: 2012:10:25:10:09:42