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.

229 Timed Out Waiting for Window to Respond


Some Control Manager functions depend on a process responding to messages posted to it's Windows message loop. If the process is busy and not executing it's message loop, the extender will eventual error and you get the timeout error message.

This seems to be a common problem with the status bar. Probably because it is often used to check for the completion of a protracted processing task.

Try using this code:

#DefineFunction cGetSBText2(ControlHandle)
    WM_GETTEXT = 13
    len = 256 ; abritrary max len
    buf=BinaryAlloc(len)
    BinaryEodSet(buf,len)
    ret = DllCall(StrCat(DirWindows(1),"user32.dll"), long:"SendMessageA", long:ControlHandle ,long:WM_GETTEXT, long:len, lpbinary:buf)
    sbtext = BinaryPeekStr(buf,0,ret)
    BinaryFree(buf)
    Return sbtext
#EndFunction

;***************************************************************************
;**
;**        Get statusbar text from active application
;**
;***************************************************************************

AddExtender("wwctl44i.dll")
title = "Statusbar Text"
BoxOpen(title, "")
WindowOnTop( title, 1 )

title="~Internet Explorer"
WinActivate(title)
While 1
   ControlHandle=cFindByClass(`msctls_statusbar32`)
   parenttitle = cWndinfo( cWndinfo(ControlHandle, 3 ), 0)
   sbtext = cGetSBText2(ControlHandle)
   BoxTitle(parenttitle)
   BoxText(sbtext)
   If IsKeyDown(@SHIFT) Then Break
EndWhile
Exit

Question:

I have an application that requires me to watch for the status bar to stop changing (there is no other indication the process is complete).

The program (Kodak PhotoDesk) allows you to edit any images that are displayed, even while others are still loading. The statusbar shows how many images are displayed and selected. It is constantly updated as more images are loaded.

The code watches for the statusbar to display the same value (stop changing) for 3 seconds, at which point I assume it is done loading.

Sometimes my code times out waiting for the status bar. The problem is I get a "WIL Extender Error: 229: Timed out waiting for window to respond."

I am running 2004E and Control Mananger v20034.

Any suggestions?

:WAIT_STATUS ;wait for statusbar to stop changing
statbar = cgetsbtext(cwndbyclass(DLLhwnd("KODAK PROFESSIONAL"), "msctls_statusbar32"))
tempbar = ""
while statbar != tempbar
tempbar = statbar 
timedelay(3)
statbar = cgetsbtext(cwndbyclass(DLLhwnd("KODAK PROFESSIONAL"), "msctls_statusbar32"))
end while
return

Answer:

#DefineFunction MySpecialGetSbText(where)
   errflag=@TRUE
   For eee=1 To 20
      LastError()         ; zero lasterror in case a previous error was suppressed.

      ErrorMode(@OFF)     ; ONLY suppress error for ONE line of code
                          ; otherwise 5 minute debugging projects tend to take 6 weeke
         statbar = cGetSbText(cWndbyclass(DllHwnd("KODAK PROFESSIONAL"), "msctls_statusbar32"))
      ErrorMode(@CANCEL)
      err=LastError()     ; puts last error code into err and clears last error
      If err==0           ; it worked
         errflag=@FALSE   ; set flag to say it worked
         Break            ; yay it worked...break out of FOR loop
      EndIf
      TimeDelay(0.5)      ; wait a half a second, then re-try
   Next
   If errflag==@TRUE
      Pause("Hmmm","Press Ok to attempt to continue")
      statbar=StrCat("Error",GetTickCount()) ; make an ALWAYS different response
   EndIf
   Return(statbar)
#EndFunction

; and your new loop
:WAIT_STATUS ;wait for statusbar to stop changing
statbar = MySpecialGetSbText("Call at top")
tempbar = ""
While statbar != tempbar
   tempbar = statbar 
   TimeDelay(3)
   statbar = MySpecialGetSbText("Call in loop")
End While

Return

Article ID:   W16334
File Created: 2013:04:10:14:35:26
Last Updated: 2013:04:10:14:35:26