load、load_dll和reload使用,大家一起讨论
reload使用static lib_path = getvar("testname") & "\\..\\backup";
reload(lib_path);
get_config(path,RemoteIP,HotBackup,hotstatus);
说明:
backup(测试类型为compiled module)中有定义函数get_config。通过reload(lib_path)加载后,可以直接使用get_config实现相应的操作。
load和load_dll如何使用,请版主、楼主和其他人士帮帮!!
转贴
下面是论坛中版主发,我想问一下,load("win32api");有什么用?能举例说明吗?谢谢!!# 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 = 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;
print(buf);
}
texit; 引用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); 请教关于load、load_dll的使用是否要对系统的api函数很熟悉??? 怎么没有人回答????? 先顶一下,
页:
[1]