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

Window Manipulation

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

How to Determine when an Untitled Window has been Closed

Keywords: 	  untitled no title

Question:

I'm using Crystal Reports, which has an untitled window that I'm trying to determine is closed. WinWaitClose can't see it. Any suggestions?

Answer:

Do a WinItemize and an ItemCount when the untitled window is up, and compare the count to a WinItemize and ItemCount AFTER the window has been closed. Are they different? If so, you could use the following code, but be sure to put up a notice to your users NOT TO CLOSE ANY OTHER WINDOWS, since that could throw the count off as well.
;before the untitled window goes up
before=WinItemize()
countbefore=ItemCount(before,@tab)

BoxOpen("ATTENTION", "DO NOT SHUT ANY OTHER WINDOWS OTHER THAN%@CRLF%THE CRYSTAL REPORT CHILD WINDOW")

;now launch the untitled window
Sendkeysto("Crystal Reports", "...") ;<==whatever keys launch the window
TimeDelay(1) ;<= give the window time to get up

;next we wait for the user to close the window

while @true
after=WinItemize()
countafter=ItemCount(after,@tab)

if countafter==countbefore 	;<==indicates window has been closed
   break
else
   TimeDelay(1)
endif

endwhile



Article ID:   W14316
Filename:   Figure out when an Untitled Window has Closed.txt
File Created: 1999:10:26:11:23:18
Last Updated: 1999:10:26:11:23:18