R. E. Cook
Contact Us 

Dr. Cook

RunningShoes Library for WinRunner 

Custom WinRunner Functions 
and Utilities,
to Your Specs

A Random Collection of WinRunner Solutions

Creating DLLs for WinRunner 
"DLLs Demystified" 
(Mercury Interactive's Worldwide Users Conference 2000)

Header control (SysHeader32) on a SysListView32 list control. 

This technique is useful on a wide variety of other controls.

Microsoft's SysListView32 is a commonly used list box. (It is the file list box in the right-hand pane of the Windows Explorer, for example.) Each column has its own header; the user can sort the list by column, by clicking the column header. 

Lack of WinRunner support

Unfortunately, WinRunner doesn't fully support the SysHeader32 control. WinRunner recognizes the header control as a single object without seeing the individual headers, which function as push buttons. 

Because WinRunner doesn't recognize the individual header for each column, it records mouse events with the obj_mouse_click() statement, with x and y coordinates for the click. The coordinates are relative to the header control: 

obj_mouse_click("SysHeader32", 320, 12, LEFT);

Resizing the header control

Users can resize the header control in a number of ways. They can resize the overall window, vary the width of the individual columns, and in some cases even change the order and contents of columns. 

The problem is, when the control is resized, the obj_mouse_click() statements fail, because the "buttons" that make up the header control have moved from their recorded positions. 


In this case the solution is easy, because WinRunner does recognize the text in the headers. Replace the recorded obj_mouse_click() statement with the obj_click_on_text() statement. WinRunner finds the text label of the individual header "button" and clicks on that text, so its location is irrelevant:

# Sort the list by filename
obj_click_on_text("SysHeader32", "Name");



Top of  This Page | R. E. Cook Home Page

Copyright R. E. Cook Consulting, 2000 - 2011.
All rights reserved.

The site is designed to look best when viewed with Internet Explorer 5.0 - 8.0. Results with other browsers will probably deviate from what is intended.

NOTE: This website refers to registered trademarks and service marks that are owned by other companies, including Mercury Interactive, WinRunner, TestDirector, TSL, Microsoft, Windows.