Microsoft KB Archive/93191

= Microsoft Knowledge Base =

WMenu, XSelectMenuItem Routines Fail with Some Applications
Last reviewed: October 19, 1994

Article ID: Q93191

The information in this article applies to:


 * Microsoft Test for Windows, version 1.0

SYMPTOMS
The WMenu or XSelectMenuItem routines in Microsoft Test may fail to activate the desired menu on some Windows applications. For example, WMenu does not work reliably on the Paintbrush application provided with Windows, version 3.1.

RESOLUTION
To work around this problem, you can first pull down one of the application's menus, either by sending the appropriate accelerator keystroke, or queuing a mouse click event that clicks the menu. Once any menu is active, the WMenu and XSelectMenuItem routines work reliably.

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.

MORE INFORMATION
The following example test script demonstrates both the problem and the workaround:

'$define TESTCTRL '$define TESTEVNT '$include: 'MSTEST.INC' Run &quot;PBRUSH.EXE&quot;, Nowait

' This fails to activate the file menu or bring up the 'Open file' ' dialog box. WMenu &quot;&File&quot; WMenu &quot;&Open...&quot;

Pause &quot;Click 'OK' to correctly activate the menu&quot;

' To work around this problem, send the appropriate ' accelerator to activate any menu, then call WMenu. DoKeys &quot;%h&quot; ' Pull down the Help menu. WMenu &quot;&File&quot; WMenu &quot;&Open...&quot;