# Function: getRandom
# Purpose: Generate integer random numbers between a range, and place them in an output array/
# Parameters: in Minimum (integer), in Maximum(integer), out RandomArray (array that holds integers)
# Return Values: Numeric Error codes: 0: OK; -1: error
load("win32api");
public function getRandom(in iMin, in iMax, out aRand[]) {
auto iRange, i;
if (iMin < 0 || iMin > iMax || (iMin + iMax)==0)
return -1;
if (int(iMin) != iMin || int(iMax) != iMax)
return -1;
iRange=(iMax-iMin) + 1;
srand(GetTickCount());
for (i=0; i<iRange; i++)
aRand[i] = int(rand()*iRange) + iMin;
return 0;
}
#When used with the following calling code, random output listings were created.
if (getRandom(1,5,aRnd)==E_OK)
{
buf="";
for (i=0; i<10; i++)
buf = buf & " " aRnd[i];
print(buf);
}
texit;作者: 沧海一粒 时间: 2006-5-24 14:41
引用pcl2004_27 在WinRunner的问题搜集(原创二)的部分
在使用该API函数前需要先加载该函数然后声明API函数,代码如下
load_dll("user32.dll");
extern int PostMessageA(in long, in long, in long, in long);
win_get_info("{class:window, MSW_class:AfxMDIFrame42, label:\"!WinRunner.*\"}", "handle", hWnd);
PostMessageA(hWnd, 16, 0, 0);作者: 沧海一粒 时间: 2006-5-24 14:43
请教关于load、load_dll的使用是否要对系统的api函数很熟悉???作者: 沧海一粒 时间: 2006-5-30 13:38
怎么没有人回答?????作者: dyq 时间: 2007-7-3 19:37
先顶一下,