Warning: file_get_contents() [function.file-get-contents]: SSL: 远程主机强迫关闭了一个现有的连接。 in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884

Warning: file_get_contents(https://whois.pconline.com.cn/jsLabel.jsp?ip=127.0.0.1) [function.file-get-contents]: failed to open stream: HTTP request failed! in D:\wwwroot\huidong\wwwroot\function.inc.php on line 884
判断按键按下的宏KEY_DOWN - huidong

huidong

首页 | 会员登录 | 关于争取 2022 寒假做出汇东网 Ver3.0.0 !
搜索文章


#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)

这样用起来方便

(GetAsyncKeyState见http://www.huidong.xyz/index.php?mode=2&id=54


但是这个是全局检测的,也就是说,如果窗口没有获得焦点,还是会获取到用户输入,所以有了下面的改进版:

// 判断键盘按下
#define KEY_DOWN(VK_NONAME) (GetForegroundWindow() == GetHWnd() && (GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)


这里的 GetForegroundWindow() 函数用来获取当前用户的焦点窗口句柄,GetHWnd() 是 easyx 的获取窗口句柄的函数


GetForegroundWindow() 见  http://huidong.xyz/index.php?mode=2&id=287 




返回首页


Copyright (C) 2018-2024 huidong