Cannot find the window with handle 0
Due to TC not be able to identify code-jock tabs in my desktop application I have had to use text recognition to find each tab and then inspect the text image to see if it is the current tab colour. I had all this working fine but now I keep running into this error each time I execute:
Cannot find the window with handle 0
My code checks that the object exists and is visble on screen before trying to take a picture of it, so I don't understand why I get this error.
set textObj = project.Variables.CentrePane.waitchild("TextObject(""" & form & "*", 0)
if textObj.exists then
if textObj.VisibleOnScreen then
log.picture (textObj.picture) 'Error: Cannot find the window with handle 0
...
All ideas welcome. Thanks.
SOLVED:
When edits were made to the form the tab label would change e.g. "myForm" becomes "myForm*"
The textObj assignment was being given the handle for the destroyed text object.
I had to execute a refresh on the parent object before making the assignment.