Microsoft KB Archive/83235

= Microsoft Knowledge Base =

Corrections for &quot;Microsoft Test for Windows User's Guide&quot;
Last reviewed: October 19, 1994

Article ID: Q83235

The information in this article applies to:


 * Microsoft Test for Windows, version 1.0

SUMMARY
Below are corrections for documentation errors in the &quot;Microsoft Test for Windows User's Guide&quot; and in the online Help file MSTEST.HLP

This master list of corrections includes and adds to the correction list found in &quot;Part 2: Notes for the User's Guide&quot; of the README.WRI file shipped with the product. Please use the article below as your master list for making corrections to the manual.

Corrections to &quot;Microsoft Test for Windows: Version 1.0: User's Guide&quot;
(Online Help only)

In the Online help only, the example for the CmpWindow function has a misplaced quotation mark, as follows:

'$DEFINE TESTDLGS ' $INCLUDE 'MSTEST.INC'

This should be changed to read as follows:

'$DEFINE TESTDLGS '$INCLUDE 'MSTEST.INC'

(This is correctly shown in the User's Guide.) (Page 38) Regarding the Sample Code:

The sample code in figure 4.2 states the following:

XDeleteFileIfExist &quot;testout.txt&quot;

This should be changed to read as follows:

XDeleteFileIfExists &quot;testout.txt&quot; (Page 39) Regarding the Sample Code:

Line 19 in the sample code in figure 4.3 states the following:

19 :XDeleteFileExist &quot;testout.txt&quot;

This should be changed to read as follows:

19 :XDeleteFileExists &quot;testout.txt&quot; (Page 43) Regarding the Pause Threshhold:

In Figure 4.6 Script Window, the Pause Threshold value should be  2000 instead of 2.

The text incorrectly states that the pause threshold within the recorder can be set to 0. The actual minimum value for the pause threshold is 55 (milliseconds) (see the README.WRI file). (Page 49)

The text incorrectly states that COMMAND$ returns the entire command-line used to start TestDrvr. Rather, it will return the first token following the /C option in the command line if present. Otherwise, COMMAND$ will contain the string assigned to it in the TestDrvr.INI file on the &quot;Cmd=&quot; line. See page 55 for the syntax of  the /C switch (from README.WRI file). (Page 96) The listed procedure names

XFileNotExist and XDeleteFileIfExist

should be changed to

XFileNotExists and XDeleteFileIfExists, respectively (Page 99) In the code example,

$INCLUDE 'FASTTEST.MST'

should be changed to

$INCLUDE 'FASTTEST.INC' (Page 103) The following FastTest procedures names are incorrect

XClick and XDblClick

should be changed to reads as follows:

XClickMouse and XDblClickMouse (Pages 105, 106)

All references to LEFT, MIDDLE, and RIGHT should be replaced by the constants LBUTTON, MBUTTON, and RBUTTON, respectively. LEFT and RIGHT are reserved words and should not be used as constants.

The FastTest examples for the mouse routines show the constant LEFT, which is a reserved word. The LBUTTON constant should be used instead. (The README.WRI file only mentions LEFT correction.)

In the second line of code at the top of page 106, XClick should be changed to XClickMouse. Also, on the second line, the following

XClick LEFT, 150, 150 ...

should be changed to read as follows:

XClickMouse LEFT, 200, 150 ...

In line 6, the following

XMoveMouse LEFT, 150, 150

should be changed to read as follows:

XMoveMouse 150, 150 (Pages 121, 123, 124, 126, 127, 128, 129, 133, 134, and in the online Help)

The syntax and the example for the following functions incorrectly use the word Exists, which is a reserved word: BButtonExists (page  121), BCheckboxExists (page 123), BComboBoxExists (page 124), BComboBoxItemExists (page 124), BEditTextExists (pages 126, 127), BListBoxExists (page 128), BListBoxItemExists (page 129), BOptionButtonExists (pages 133, 134).

For all of these functions, Exists% should be changed to another variable name, such as Exist%. For example:

Exists% = BbuttonExists(&quot;OK&quot;)

Exists% is a reserved word and should be changed to another variable name, such as the following:

Exist% = BButtonExists(&quot;OK&quot;) (Page 161)

References to DCmp and DNotCmp in the code example, should be  changed to the following:

XCWDCmp and XCWDNotCmp (Page 198 and online Help)

The Xstartapp Example has a syntax error. The line

XstartApp &quot;Write.Exe&quot;

should be changed to read as follows:

XstartApp &quot;Write.Exe&quot;, &quot;&quot; (Page 218)

The following line is incorrect

c = a XOR b    ' c equals 00000000000001110 (14 in decimal)

and should be changed to read as follows:

c = a XOR B    ' 00000000000001110 (6 in decimal) (Page 241)

TestBasic &quot;File Input and Output&quot; source code example, middle of  the page:

INPUT #infile, StringVar

should be changed to read as follows:

LINE INPUT #infile, StringVar (Page 275)

The code example is missing a Declare SUB statement. The following Declare statement should appear after the INCLUDE statement:

Declare Sub SetCWTitle Lib &quot;CWTrap.DLL&quot; (lpszNewTitle$) (Page 286)

The following incorrect comment in the Sub ExitApp

DoKeys &quot;%fx&quot;    '*** Send CTRL+F+X to the program to exit

should be changed to read as follows:

DoKeys &quot;%fx&quot;    '*** Send ALT+F+X to the program to exit (Page 326)

In the first sentence of the &quot;Example&quot; section a &quot;w&quot; was left out of the word &quot;window&quot;. The sentence should be changed to  read as follows:

This example compares the currently active window with the window stored in TESTFILE.TDL at index 1, including the parent window in the comparison. (Pages 339, 347, 348, 349)

In the example programs for fCompScreen, fDumpScreen, fDumpScreenActivate, and fDumpSrnToClip, the following statement is  incorrect, and will give a &quot;Type identifier expected&quot; error message on SrnReg (because SrnReg is not defined in the include files):

Dim CurSrnReg as SrnReg

This statement should be changed to read as follows:

Dim CurSrnReg as wRect (Page 342)

The code example sets values for CurSrnReg and never uses or  defines that type structure. The section of code that sets the values of CurSrnReg should instead be included in the code example for fCompScreen on Page 339. (Page 346)

The last line of the code example

i% = fDumpScreen% (f$, CurSrnReg 0, 0, FALSE)

should be changed to read as follows:

i% = fDumpScreen% (f$, CurSrnReg, 0, 0, FALSE) (Pages 415, 431, 465, 497, and in the online Help for the functions

named below). The following line is incorrect:

WstaticSetClass &quot;ThunderLabel&quot;

in the example for each of the following functions:

WStaticSetClass (Page 497), WListSetClass (Page 465), WComboSetClass (Page 415), WEditSetClass (Page 431)

The Window Text for Visual Basic labels (Class ThunderLabel) is  always NULL(&quot;&quot;). This prevents any of the function examples for WListSetClass, WComboSetClass, and WEditSetClass from working because regardless of what text appears in a Visual Basic label, the WindowText which is used by these examples will not be found.

The examples should be changed to read as follows:

(page 415)

WStaticSetClass &quot;NewStaticTextClass&quot; WComboSetClass &quot;NewComboSetClass&quot;

(page 431)

WStaticSetClass &quot;NewStaticTextClass&quot; WEditSetClass &quot;NewEditClass&quot;

(page 465)

WStaticSetClass &quot;NewStaticTextClass&quot; WListSetClass &quot;NewListClass&quot;

(page 497)

WStaticSetClass &quot;NewStaticTextClass&quot; (Page 441)

The following line in the last paragraph is incorrect

&quot;... editor (SYSEDIT.EXE), and if not found, gives it ...&quot;

and should be changed to read as follows:

&quot;... editor (SYSEDIT.EXE), and if found, gives it ...&quot; (Page 444 and in the online Help file MSTEST.HLP)

The following syntax for WGetInfo is incorrect

Syntax:    REM $DEFINE W_WINDOW REM $INCLUDE 'MSTEST.INC'

and should be changed to read as follows:

Syntax:    REM $DEFINE TESTCTRL REM $INCLUDE 'MSTEST.INC'

For the WGetInfo procedure's Parameters section, the INFO structure should be changed to read as follows:

Type INFO                            '<- changed hWnd           As Integer hWndParent     As Integer szClass        As String * MAX_CAPTION szCaption      As String * MAX_CAPTION szParentClass  As String * MAX_CAPTION szParentCaption As String * MAX_CAPTION szModuleName   As String * MAX_CAPTION lStyle         As Long fChild         As Integer wID            As Integer wLeft          As Integer        '<- changed wTop           As Integer        '<- changed wRight         As Integer        '<- changed wBottom        As Integer        '<- changed wWidth         As Integer        '<- changed wHeight        As Integer        '<- changed End Type

As shown above, the user defined type WNDINFO should be type INFO, and Left, Top, Right, Bottom, Width, and Height need to be  prefaced with a 'w'. (Page 445)

The example of WGetInfo at the top of the page is missing a DEFINE statement; please change the following:

' $INCLUDE 'MSTEST.INC'

to the following:

' $Define TESTCTRL ' $INCLUDE 'MSTEST.INC'

The following line, in the &quot;Syntax&quot; section of the explanation of  WGetText and GetText in the middle of the page, is incorrect:

REM $DEFINE W_WINDOW

and should be changed to read as follows:

REM $DEFINE TESTCTRL

The example for the GetText and WGetText functions at the bottom of the page is missing a DEFINE statement, and should be changed to read as follows:

'$DEFINE W_MISC '$INCLUDE 'MSTEST.INC' print GetText(0) (Page 447)

The last two lines of the example should include the following:

WGetWndPos 0, lpWndPos, W_ABSOLUTE Print lpWndPos.wTop, lpWndPos.wLeft (Page 448)

All references to the top left width and height as field names of a user defined type should have a w preceding them. The field names listed below should be changed to the following:

left should be wleft top should be wtop width should be wwidth height should be wheight

In the last code example on Page 448,

Print lpWndPosSiz.left, lpWndPosSiz.Top

should be changed to read as follows:

Print lpWndPosSiz.wleft, lpWndPosSiz.wTop (Pages 484-490)

The code examples on Pages 484-490 incorrectly document the '$Define statement to include a colon. For example:

' $DEFINE: W_OPTION

should instead be documented as below:

' DEFINE W_OPTION

Failure to remove the &quot;:&quot; will result in a &quot;Syntax Error&quot; message. (Page 449)

The following type definition for winsize in the comment section:

Type winsize width as integer height as integer End Type

should be changed to read as follows:

Type winsize wwidth as integer wheight as integer End Type (Page 488)

WOptionSelect is a sub, so the example should be changed to read as follows:

WOptionSelect &quot;&Landscape&quot; (Page 536)

The following sentence is incorrect

The function returns a value greater than 32 if the process was successfully spawned.

and should be changed to read as follows:

The function returns a value of zero (0) if the process was successfully spawned.

Also, add the following section after the third sentence in  the Comments section for the RUN function:

The return codes of the RUN function are identical to those used for the Windows API call WinExec, except for a return code of 0. A return code of 0 from the Microsoft Test RUN function actually indicates success, whereas a return code of 0 indicates an &quot;Out of memory&quot; error when returned from the Windows API call WinExec. (Page 538)

The syntax of SLEEP reads as follows:

SLEEP(intexp%)

It should be changed to read as follows:

SLEEP intexp% (Page 541) (and in the online Help, MSTEST.HLP, under the TIMER function)

The following description for the TIMER function is incorrect

The TIMER function gives the number of seconds (in     hundredths) since midnight.

and should be changed to read as follows:

The TIMER function gives the number of milliseconds since Windows was started.

Because the TIMER function returns a LONG integer, the following syntax example is incorrect

Ret% = TIMER

and should be changed to read as follows:

Ret& = TIMER (Chapter 10, &quot;MSTest Procedure Reference&quot;, pages 307-500; additional

documentation from the README.WRI file)

When a script is sending keystrokes to close an application, the situation may arise where the keystrokes are sent to the Test Driver itself instead of the application being tested. If this happens, a deadlock may occur within the system, requiring the test computer to be rebooted. This situation can arise, for example, when the application being tested fails and exits, and the Test Driver becomes the active application. When the script then sends keystrokes to close the application, they are sent to the Test Driver, which can cause a deadlock. This will only happen for keystroke sequences that tell the Test Driver to close itself, such as &quot;% c&quot; (ALT+SPACEBAR+C) or &quot;%fx&quot; (ALT+F+X) or &quot;%{F4}&quot; (ALT+F4). It is usually a good idea to first verify that the application being tested is running and is the active application before sending the keystrokes to close it. This verification can be done using Test for Windows Procedures. See the MSTest Procedure Reference for more information.

When running a Test for Windows script that contains any kind of  UAE trap, it is necessary to make sure that the &quot;Dr. Watson&quot; application (DRWATSON.EXE) is not running. UAE traps set within Test for Windows scripts conflict with this application. Dr. Watson is a Microsoft diagnostic tool that is provided with Windows version 3.1, and is located in the main Windows directory.