如果我发送WM_KEYDOWN消息(使用wndproc),计算机会一直按住该键,直到发送WM_KEYUP吗? [英] If I send a WM_KEYDOWN message (using wndproc) will the computer hold the key down until I send WM_KEYUP?

查看:355
本文介绍了如果我发送WM_KEYDOWN消息(使用wndproc),计算机会一直按住该键,直到发送WM_KEYUP吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种解决方案,以编程方式在某个时间(不知道多少时间)内按下键盘键.

I am looking for a solution to programmatically hold a keyboard key down during some time (I don't know how many time).

我认为,如果我发送WM_KEYDOWN消息,则在发送WM_KEYUP之前,该密钥将一直处于按住状态,但是我不确定.

I think that if I send a WM_KEYDOWN message the key will be held down until WM_KEYUP is send, but I am not sure.

我会测试一下.但是我需要走了,我没有很多时间.我想看看是否有人已经对此进行了测试.

I would test it. But I need to go and I don't have much time. I want to see if someone already tested this.

这是我发布的另一个与此问题相关的问题.

Here is an other question I posted, related to this one.
I want to make a virtual keyboard. Do I need to send WM_KEYDOWN to the current active window or HWND_BROADCAST?

推荐答案

否,因为如果检查使用键盘时发送的消息,则会看到以下消息:

No, because If you examine the messages sent when using the keyboard, you'll see that the message are as follow:

WM_KEYDOWN
WM_KEYPRESS
WM_KEYUP

WM_KEYPRESS消息每隔两次滴答发送一次(取决于键盘配置).

The WM_KEYPRESS message is sent every couple of ticks (depending on the keyboard configuration).

这篇关于如果我发送WM_KEYDOWN消息(使用wndproc),计算机会一直按住该键,直到发送WM_KEYUP吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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