51Testing软件测试论坛

标题: 键盘跟踪 [打印本页]

作者: yuzhu656    时间: 2006-7-5 17:49
标题: 键盘跟踪
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申明
作者: eric.y    时间: 2006-7-5 23:04
#define NULL 0
估计TRUE,FALSE也是没有定义的




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2