Test Must Use "DoKeys {126}" to Send Literal Tilde Character

ID Number: Q81221

1.00

WINDOWS

buglist1.00

Summary:

The DoKeys and QueKeys routines (contained in TESTEVNT.DLL) convert a

character string of characters into Windows journalling messages and

play the messages back to the active window.

To send a literal tilde character (~) using DoKeys or QueKeys, you

need to enter the following:

DoKeys "{126}"

DoKeys "{~}" does not work as expected, and contrary to what is

explained in the Test online Help, will result in an ENTER keystroke

(carriage return) being sent to the active window, not a literal

tilde.

Microsoft has confirmed this to be a problem in Microsoft Test version

1.0 for Windows. We are researching this problem and will post new

information here as it becomes available.

More Information:

DoKeys carries out the same action as calling QueKeys and QueFlush,

and can be used in a Test script to simulate keystrokes. The tilde

character is a special character normally used by DoKeys/QueKeys to

represent the ENTER key; therefore, Chapter 10 of the "Microsoft Test

for Windows: User's Guide" recommends putting the tilde character

inside braces to send this character to the active window. However,

placing brackets around a tilde character incorrectly results in an

ENTER keystroke being sent to the active window.

The following steps reproduce the problem of the DoKeys sending an

Enter keystroke instead of a tilde even though the tilde character is

enclosed in curly braces as recommended.

Steps to Reproduce Problem

--------------------------

1. Launch the Test Driver application by double-clicking its icon in

Program Manager.

2. In a new test script, type the following code to start the Windows

NOTEPAD.EXE program and send it keys.

'$define testevnt

'$include 'mstest.inc'

run "notepad.exe",nowait

DoKeys "{126}"

DoKeys "{enter}"

DoKeys "126 in brackets will print as a tilde "

DoKeys "{~}"

DoKeys "this text should be preceded by a tilde"

DoKeys "{enter}"

DoKeys "but instead it is on a new line as if enter had been typed"

3. From the Run menu, choose Start to run the script.

The output in Notepad will appear as follows:

~

126 in brackets will print as a tilde

this text should be preceded by a tilde

but instead it is on a new line as if enter had been typed

Note: The tilde did not print, but instead acted as a carriage return

in Notepad, making the text of the next DoKeys start on the next line.

This behavior is incorrect. Using braces {} around the other special

characters (plus sign [+], caret [^], and percent sign [%]) works as

expected, and produces the literal characters instead of the special

DoKeys/QueKeys interpretation.

Additional reference words: 1.00

#:bx4a

{ewl navigate.dll, ewcright, /f"Test Must Use "DoKeys {126}" to Send Literal Tilde Character"}