Test for Windows: Undocumented Procedures in TESTCTRL.DLL

ID Number: Q83106

1.00

WINDOWS

Summary:

Three procedures in the TESTCTRL.DLL dynamic link library are

undocumented in the Test for Windows manuals. These three procedures

became available after the Test for Windows product documentation had

been sent to press. The information below is also documented in the

README.WRI file the Setup program automatically copies into the

This information applies to Microsoft Test version 1.0 for Windows.

More Information:

The three undocumented procedures in TESTCTRL.DLL are:

- WGetInfo

- WDisplayInfo

- WMenuSeparator

These procedures are documented below.

WGetInfo

--------

Description: Obtains detailed information about the window

identified by hWnd%, or, if hWnd% is NULL,

information on the currently active control

within the currently active window is obtained.

Syntax: DECLARE SUB WGetInfo Lib "TESTCtrl.dll" (hWnd%, lpInfo)

Parameters: hWnd% INTEGER handle of window from which

information is retrieved.

lpInfoINFO Type into which the information is copied.

Return values: None

Comments: Information retrieved is similar to that information

received when browsing Windows with the Windows SDK

SPY.EXE application. Information is stored in the

structure lpInfo, which has the following fields:

Type INFO

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

wtop As Integer

wright As Integer

wbottom As Integer

wwidth As Integer

wheight As Integer

End Type

If the window does not have a parent, hWndParent will be NULL. The

five fixed-length string fields need not be initialized to spaces or

anything else before the call to WGetInfo() is made. On return, the

fields will contain the information padded with trailing spaces, so

RTrim$() can be used on the fixed-length strings. If any of the

string fields do not apply to the window identified by hWnd%, those

fields will contain all spaces on return; thus RTrim$() on the field

will return a NULL string.

The variable fChild is a Boolean field. If the window is a child

window, such as the Windows WS_CHILD type, fChild is True; otherwise

fChild is False. The variable wID is only valid if fChild is True.

The variables wleft, wtop, wright, and wbottom are all returned using

absolute screen coordinates.

WDisplayInfo

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

Description: Obtains detailed information about the window

identified by hWnd%, or, if hWnd% is NULL,

information on the currently active control

within the currently active window is obtained.

Syntax: DECLARE SUB WDisplayInfo Lib "TESTCtrl.dll" (hWnd%, wDisplay%)

Parameters: hWnd% INTEGER handle of window from which

information is retrieved.

wDisplay% INTEGER which indicates the method of

information display.

Return Values: None

Comments: This procedure is similar to WGetInfo, but instead of

returning information in a structure, information about

the window is displayed in a modal dialog box or on a

debug monitor. The variable wDisplay% indicates where

the data about the window should be sent. wDisplay%

can take one of three values, which are constants

defined in the MSTEST.INC file as follows:

DI_DIALOG (1) Information is displayed in a modal

dialog box.

DI_DEBUG (2) Information is sent to a debug monitor.

DI_BOTH (3) Information is displayed in a modal

dialog box and sent to a debug monitor.

Example: The following example displays window information for

the currently active window in a modal dialog box:

'$INCLUDE: 'MSTEST.INC'

WDisplayInfo WGetActWnd(0), DI_DIALOG

WMenuSeparator

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

Description: Returns True if the specified menu item is a

menu separator; False if it is not a menu separator.

Syntax: DECLARE FUNCTION WMenuSeparator Lib_

"TESTCtrl.dll" (sIndex%) As Integer

Parameters: sIndex% the index of the menu item on the menu

Return Values: True if the menu item is a separator, False if it is not.

Comments: Unlike the other menu routines, WMenuSeparator does not

ignore menu separators when a menu item is specified by

an index. The first menu item is item number 1, the

second is item number 2, and so on, including all

separators.

Example: Given the following menu structure:

File

Open

Save

Save As

-----------

Close

-----------

Exit

WMenuCount would return 5, because it ignores

separators. If you want to use WMenuX to select the Exit

command, use:

WMenuX 5

instead of:

WMenuX 7

The string returned by the call MenuText(4) would be

"Close", not NULL, for the separator at position 4.

However, when using WMenuSeparator to determine if an

item is a separator or not, the menu items should have

the following indexes:

File

1 Open

2 Save

3 Save As

4 -----------

5 Close

6 -----------

7 Exit

Therefore, the output from the following loop:

For I = 1 to 7

Print WMenuSeparator(i)

Next I

would be:

0 0 0 -1 0 -1 0

Additional reference words: 1.00