| Question: | In the following example, the test calculates the percentage shown in the progress bar of the sample Meter application. To make the calculation, WinRunner loads two functions declared in an external DLL.
| | Answer: | | PHP-Code: |
# Declare two meter.dll functions for retrieving the total size and completed size of the meter.
extern int get_meter_total_size (unsigned int);
extern int get_meter_completed_size (unsigned int);
# Link with meter16.dll.
function init_meter_cc(lib_path)
{
load_16_dll (lib_path & "meter16.dll");
return(E_OK);
}
# Calculate the meter percentage.
function calc_meter_percentage (meter, out completed_percent)
{
auto handle, total, completed;
# Retrieve meter window handle with TSL function 'obj_get_info'.
obj_get_info(meter, "handle", handle);
# Use meter.dll functions to get meter total & completed sizes.
total = get_meter_total_size (handle);
completed = get_meter_completed_size (handle);
# Calculate meter completed percentage.
completed_percent = completed * 100 / total & "%";
return(E_OK);
}
|
| | last updated 19.08.2003 | |
| 1 user questions (display) | user rating:  comments on ratings | |
|