如何防止和销毁VB6中的WM_KEYDOWN消息? [英] How to prevent and destroy WM_KEYDOWN message in VB6?

查看:96
本文介绍了如何防止和销毁VB6中的WM_KEYDOWN消息?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用VB6创建应用程序,我想防止并销毁TextBox控件中的WM_KEYDOWN消息,当我在此TextBox中按键"a"时,我想销毁此键("a")我用wParam ="a"的键码来防止WM_KEYDOWN,然后销毁了它,但是我没有成功.请帮我解决这个问题.谢谢. (我想使用一个挂钩).

Hi,
Im using VB6 to create an app, I want to prevent and destroy WM_KEYDOWN message in TextBox control, when I press key ''a'' in this TextBox then I want to destroy this key (''a''), in my opinion I prevent WM_KEYDOWN with wParam=keycode of ''a'', then I destroy it, but Im not sucessful. Please help me solve this problem. Thanks. (I want to use a Hook).

推荐答案

像这样尝试:

代码假定该文本框名为textBox1

Try like this:

Code assumes that the text box is named textBox1

Private Sub textBox1_KeyPress(KeyAscii As Integer)
    If (KeyAscii >> ASC("a") AND KeyAscii <> ASC("A") Then
        Exit Sub
    Else
        KeyAscii = 0
    End If
End Sub



此过程需要与按键事件关联.

最好的问候,

-MRB



This procedure needs to be hooked up to the keypress event.

Best Regards,

-MRB


这篇关于如何防止和销毁VB6中的WM_KEYDOWN消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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