积极答复者
关于sendkeys的问题

问题
答案
-
你需要确定接收键盘消息的窗口句柄是否找对了.
可以使用SendMessage试试看.
另外,在模拟击键的时候,最好保证游戏主窗口能够获得焦点,否则消息可能被游戏忽略.
也就是说,你的击键模拟需要有一种激活的手段,不能自己写个程序,点个按钮就指望把消息发过去,
也许发过去了,但是游戏本身可能忽略消息,因为他没有焦点,各种不同的游戏有不同的处理方法,
比如完美世界,一旦游戏窗口失去焦点,按键就不管用,SendKey自然 也不管用.
- 已标记为答案 BoberSongModerator 2010年9月15日 6:48
-
也得看对方是否认消息。如果是游戏的话,很多不处理消息,直接访问键盘驱动的。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 BoberSongModerator 2010年9月15日 6:48
全部回复
-
你需要确定接收键盘消息的窗口句柄是否找对了.
可以使用SendMessage试试看.
另外,在模拟击键的时候,最好保证游戏主窗口能够获得焦点,否则消息可能被游戏忽略.
也就是说,你的击键模拟需要有一种激活的手段,不能自己写个程序,点个按钮就指望把消息发过去,
也许发过去了,但是游戏本身可能忽略消息,因为他没有焦点,各种不同的游戏有不同的处理方法,
比如完美世界,一旦游戏窗口失去焦点,按键就不管用,SendKey自然 也不管用.
- 已标记为答案 BoberSongModerator 2010年9月15日 6:48
-
也得看对方是否认消息。如果是游戏的话,很多不处理消息,直接访问键盘驱动的。
The following is signature, not part of post
Please mark the post answered your question as the answer, and mark other helpful posts as helpful, so they will appear differently to other users who are visiting your thread for the same problem.
Visual C++ MVP- 已标记为答案 BoberSongModerator 2010年9月15日 6:48