|
function GetKeyStatus(in vKey){
auto pid, thread_id, win_desc, hWnd, KeyState, win_log_name, win_full_desc, focused_obj_desc;
win_desc = "{active:1}";
if (win_exists(win_desc)==0){
win_get_desc(win_desc, "", "", "", win_full_desc);
GUI_map_get_logical_name( win_full_desc, "", win_log_name, "bla");
win_get_info(win_desc, "handle", hWnd);
pid = GetWindowThreadProcessId(hWnd, NULL);
thread_id=GetCurrentThreadId();
AttachThreadInput(pid,thread_id,TRUE);
KeyState=GetKeyState (vKey);
AttachThreadInput(pid,thread_id,FALSE);
if (KeyState < 0)
return(0); # Key is pressed
else
return (1); # Key is not pressed
}
else
return (-1); # No active window found, so cannot determine key state
}
这是在“WinRunner的问题整理“中的,我也有修改Test Properties中的Test Type,可运行弹出的是NULL申明 |
|