FAQ all FAQ for this program Search
Web Resources : WinRunner : Calculate the %age shown in the progress bar Print send FAQs by e-mailask a questionwrite comment
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
3354 User comments   (display)
1 user questions   (display)
user rating: 0.67 of 3.00, 3 ratings
comments on ratings
 How do you rate this article?  
Reason:

 
[previous FAQ]  
List FAQ in this category | List categories | List all FAQ | List programs goto top
Program:   
category:   
||nagendra.net|| - making the C~o~N~n~E~x~I~o~N~s