Microsoft Knowledge Base |
|
How to Use Visual Test Version 4.0 with Custom Controls |
|
|
Last reviewed: July 25, 1996
Article ID: Q135767 |
|
The information in this article applies to:
SUMMARYVisual Test offers many high-level functions that make it easy to manipulate, control, retrieve data from, and send data to the standard Windows-based controls. To make Visual Test a robust testing platform, each of the control functions verify that the window they will act on has a class name that matches the control type specified. (See the "Class Names Visual Test Recognizes" section of this article for more information.) If the targeted window has the wrong class name, the control function generates a run-time error indicating that the control is not found. Many custom controls are created to extend the functionality of a standard Windows-based control. These custom controls exhibit features very similar to the standard controls that they enhance and, in most cases, can be used by Visual Test as if they are the standard control. However, a common technique used to enhance a standard control, called superclassing, changes the window's class name, thus causing Visual Test to fail to recognize the control as handling standard Windows-based control properties.
MORE INFORMATIONSuperclassing is a technique that allows an application to create a new window class with the basic functionality of the existing class plus enhancements provided by the application. A superclass is based on an existing window class called the base class. Frequently, the base class is a system global window class such as an edit control, but it can be any window class. Once a window is created from the base class and information about the window's style is obtained, the window is destroyed. Then a new window class is registered by using the information obtained from the base class with some slight modifications to that information. The superclassed custom control is then created using the attributes of the newly created superclass. For more information on the implementing a superclass, please see the Win32 Software Development Kit (SDK) by drilling down the following hierarchy: Overviews Window Management
Window Procedures
About Window Procedures
Window Procedure Superclassing
Class Names Visual Test RecognizesThe following table outlines the class names that Visual Test recognizes as being standard Windows-based controls.
Control Type Recognized Class Names Check Box Button
ThunderCheckBox
Combo Box ComboBox
ThunderComboBox
Command Button Button
ThunderCommandButton
Header SysHeader32
Label Static
ThunderLabel
MT_Sb_Field
List Box ListBox
ThunderListBox
List View SysListView32
Option Button Button
ThunderOptionButton
Progress msctls_progress32
msctls_progress
Slider msctls_trackbar32
Spin msctls_updown32
msctls_updown
Status Bar msctls_statusbar32
Tab SysTabControl32
Text Box Edit
RBEDIT
RICHEDIT
ThunderTextBox
Tool Bar ToolbarWindow32
Tool Tips tooltips_class32
tooltips_class
MT_Popup_Help
Tree View SysTreeView32
How to Change Recognized Class NamesMost families of control functions offer a W*SetClass function, the '*' represents the family of control functions that SetClass will act upon. The W*SetClass takes one string argument, which represents the new class(es) that will be recognized by Visual Test as being a particular Windows control.
' The following line makes Visual Test ' recognize only 'MyEdit' as being an edit control:WEditSetClass "MyEdit"
' Note: to make Visual Test recognize more than ' one class name use a backslash (\) to delimit ' the class names:WEditSetClass "MyEdit\edit" Please see the Visual Test Help menu for further details about W*SetClass.
Using WInfo to Determine a Window's Class NameOn the Test menu, click WInfo. The Window Information dialog box is displayed. Drag the target to the window for which you need information. The class name of the window will appear in the Class Name edit control.
Step-by-Step Demonstration of W*SETCLASS
|
|
Additional reference words: 4.00 Win32
©1997 Microsoft Corporation. All rights reserved. Legal Notices. |