关于发送键盘信息的有关问题
关于发送键盘信息的问题
各位大虾们好,小的有个问题需要大家解惑。
我现在有个用于远程登陆的小控件,我现在想实现自动填写功能,比如,我把登陆地址,端口号,用户名,密码等信息存到指定位置,控件将这些内容取到,然后可以自动填写这些内容,进行登陆,但是我发现有个地方需要按一下键盘的左方向键,请问:
用SendMessage方法可以实现这个功能吗?SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);这样写有什么问题?我也不知道这个VK_LEFT,是具体什么值。。。。求解。网上搜的左方向键是0x25,可是这不是“%”的ASCII码值吗?我这样写屏幕上是不是出现了一个“%”?
新手恳求大家给与帮助。
------解决方案--------------------
看看这里虚拟键盘值和ascii码的对应关系吧
http://wenku.baidu.com/view/62eecc7da26925c52cc5bf54.html
------解决方案--------------------
VK和ASCII不是一回事。
------解决方案--------------------
WM_KEYDOWN
The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_KEYDOWN
WPARAM wParam, // virtual-key code
LPARAM lParam // key data
);
Parameters
wParam
Specifies the virtual-key code of the nonsystem key.
------解决方案--------------------
http://www.autohotkey.com
各位大虾们好,小的有个问题需要大家解惑。
我现在有个用于远程登陆的小控件,我现在想实现自动填写功能,比如,我把登陆地址,端口号,用户名,密码等信息存到指定位置,控件将这些内容取到,然后可以自动填写这些内容,进行登陆,但是我发现有个地方需要按一下键盘的左方向键,请问:
用SendMessage方法可以实现这个功能吗?SendMessage(hwnd, WM_KEYDOWN, VK_LEFT, 0);这样写有什么问题?我也不知道这个VK_LEFT,是具体什么值。。。。求解。网上搜的左方向键是0x25,可是这不是“%”的ASCII码值吗?我这样写屏幕上是不是出现了一个“%”?
新手恳求大家给与帮助。
------解决方案--------------------
看看这里虚拟键盘值和ascii码的对应关系吧
http://wenku.baidu.com/view/62eecc7da26925c52cc5bf54.html
------解决方案--------------------
VK和ASCII不是一回事。
------解决方案--------------------
WM_KEYDOWN
The WM_KEYDOWN message is posted to the window with the keyboard focus when a nonsystem key is pressed. A nonsystem key is a key that is pressed when the ALT key is not pressed.
A window receives this message through its WindowProc function.
LRESULT CALLBACK WindowProc(
HWND hwnd, // handle to window
UINT uMsg, // WM_KEYDOWN
WPARAM wParam, // virtual-key code
LPARAM lParam // key data
);
Parameters
wParam
Specifies the virtual-key code of the nonsystem key.
------解决方案--------------------
http://www.autohotkey.com