如何在游戏中模拟键盘 [英] how to simulate keyboard in game

查看:573
本文介绍了如何在游戏中模拟键盘的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在游戏中模拟键盘.我尝试使用keybd_event,当按下向上"键时,它在游戏中不起作用.

I want to simulate keyboard in game .I try to use keybd_event, it doesn''t work in game when press ''up'' key.

推荐答案

这取决于您正在处理的事件以及执行操作时的操作.
如果处理键盘事件,则将取决于处理它们的位置:如果窗体具有接受键盘输入的控件,则您必须为其处理事件以及窗体本身,因为它们将获得输入焦点并处理键击-这表示表格无法获取.
到目前为止,你做了什么?
It depends on what event you are handling, and what you are doing when you do.
If you handle keyboard events, it will depend where you handle them: if you form has controls that accept keyboard input, then you must handle the event for them as well as the form itself, as they will get the input focus and process the keystroke - which means the form doesn''t get it.
What have you done so far?


这篇关于如何在游戏中模拟键盘的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆