51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2349|回复: 1
打印 上一主题 下一主题

键盘跟踪

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2006-7-5 17:49:34 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
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申明

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?(注-册)加入51Testing

x
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2006-7-5 23:04:23 | 只看该作者
#define NULL 0
估计TRUE,FALSE也是没有定义的
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-9-24 00:22 , Processed in 0.074788 second(s), 29 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表