Forum Discussion

mfoster711's avatar
mfoster711
Regular Contributor
13 years ago

Checking ActiveWindow in debug mode

In my vbscript code I am check if the ActiveWindow has changed as a method of determining if an error/unexpcted window may have displayed. The code works fine but it doesn't work if I am stepping through the code in debug mode. TestComplete will tell me the ActiveWindow is the actual TestComplete window. 



Is there anyway around this so the code works in debug mode? Is the a better method other than using ActiveWindow?

2 Replies

  • I ussualy use something like Process.FindChild("WndCaption", "*Error*",1) for an expected / possible error window, and if it is an unexpected window TestComplete knows how to post an error message to the log and get around it.



    But if you insist on using ActiveWindow you could set focus on the window of your application before checking the active window, error messages are set to be "always on top" of your application's window, so it will automatically become the active window after setting focus on your application..
  • mfoster711's avatar
    mfoster711
    Regular Contributor
    I know how to use ActiveWindow and my code works fine. I am just curious if there is a way to get it to work while debugging my script and stepping through the code. When stepping through code the ActiveWindow will be the TestComplete window, not the window in my application under test.