title: Continual Check for Pop Up in QTP
body: <p>I have an error window that pops up every once in a while when my application is running. It is a Java Swing application and the error is displayed when an exception is caught, but not necessarily handled in a way that can be fixed. For example handling an exception that can be fixed would be like if I divided by zero I would be able to catch an ArithmeticException and display a box that says something like "You tried to divide by zero, please try again..."</p>
  
  <p>The error that I'm receiving is due to a try..catch block catching ANY exception, but the exception is just some Java exception that the user would know nothing about so then telling the END USER (QTP in this case) that an "unexpected error" occurred. The application has been under development for a couple years now so it is terribly complex and there is no way that QTP can handle these errors unless I literally add some <code>CheckForUnexpectedError</code> function that is called every other line of the script. Is there any way to make some sort of function that is constantly running in the background checking if this particular error window pops up? If the window pops up the test should fail, but I have no way of predicting when the window will pop up, and thus, I can't handle it in QTP and my script just gets stuck unless I have that way to constantly check for it in the background.</p>