Microsoft KB Archive/85437

= Microsoft Knowledge Base =

QuePause May Fail if Active Window Changes Before QueFlush
Last reviewed: October 19, 1994

Article ID: Q85437

The information in this article applies to:

- Microsoft Test for Windows, versions 1.0

SYMPTOMS
If the active window is changed between the start of an event queue (using the TESTEVNT.DLL API routines) and the terminating QueFlush statement, the QuePause statements inserted in the event queue may not take effect.

RESOLUTION
To work around this problem, insert a QueFlush statement immediately before the QuePause statement. This will ensure that the active window does not change before the QuePause statement is executed.

STATUS
Microsoft has confirmed this to be a bug in Microsoft Test version 1.0 for Windows. This bug was corrected in Microsoft Test version 2.0 for Windows.

Script to Reproduce Problem
'$define TESTEVNT '$include 'MSTEST.INC' QueKeys &quot;%frnotepad{ENTER}&quot;

'QueFlush 1                     'Uncomment to avoid problem

QuePause 30000                  'Pause for 30 seconds QueKeys &quot;How does this look&quot; QueFlush 1

If you run the above script with only Test Driver and Program Manager active, and Test Driver is set to minimize on run (under the Environment option of the Test Driver Options menu), Notepad will start, but the string &quot;How does this look&quot; will appear almost immediately after Notepad is started.

Workaround
To work around the problem, remove the comment on the QueFlush statement just before the QuePause statement. Performing a QueFlush will start a new event queue, and Notepad will be the active window from the start of the queue (the QuePause statement) to the terminating QueFlush statement.