如何在窗口中正确处理击键? [英] How to handle keystrokes properly in a window?

查看:71
本文介绍了如何在窗口中正确处理击键?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,朋友
我通过调用win32 CreateWindow函数创建了一个窗口,并在其上放置了一些编辑控件(编辑控件也由CreateWindow函数创建).
它工作正常,要在受控对象之间导航,请执行WM_kEYDOWN和WM_KEYUP的操作,并检测TAB和shift + TAB键.它也可以很好地执行并发出提示音,每次按下TAB时都会发出提示音,这会打扰用户.我需要一种方法来抑制TAB和其他一些按键的声音.请注意,由于这是Win32窗口而不是对话框,因此不会将WM_GETDLGCODE发送到编辑控件.任何建议表示赞赏,也有任何相关的文章.
在此先感谢
abzadeh

Hello, friends
I created a window by calling win32 CreateWindow function, and put some edit controls on it, (Edit controls also created by CreateWindow function).
It works fine, To navigate between controld, I cachw WM_kEYDOWN and WM_KEYUP, and detect TAB and shift+TAB keys. It also works fine, execpt for a beep sound, which sounds every time TAB is pressed, bothering the user. I need a way to supress this sound for TAB, and some other keystrokes. Note that since this is win32 window and not a dialog, WM_GETDLGCODE is not sent to edit controls. any suggestions appreciated, any related articles also.
Thanks in advance
abzadeh

推荐答案

在编辑控件处理特定键时发出蜂鸣声.为避免这种情况,您可以在编辑控件的消息处理中忽略这些键(WM_CHAR消息),或在父窗口(对话框)消息处理中对其进行处理.
The beep is emitted when the edit control processes specific keys. To avoid this, you may ignore these keys (WM_CHAR message) in the message processing of the edit control or handle them in the parent windows (dialog) message processing.


这篇关于如何在窗口中正确处理击键?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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