关于(KeyAscii 码转换的问题)~请各位师傅进来帮帮忙!!
程序代码:
Private Declare Function GetKeyNameText Lib "user32" Alias "GetKeyNameTextA" (ByVal lParam As Long, ByVal lpBuffer As String, ByVal nSize As Long) As Long Private Declare Function MapVirtualKey Lib "user32" Alias "MapVirtualKeyA" (ByVal wCode As Long, ByVal wMapType As Long) As Long Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) Dim s As String s = String(100, Chr(0)) GetKeyNameText MapVirtualKey(KeyCode, 0) * 65536, s, 100 s = Left(s, InStr(s, Chr(0))) Me.Cls Print s End Sub
我用的源码是这里
KeyAscii 替换上去就提示错误
是不是声明限制了!!
还有运行不正常!应该怎么写才对呢!
我想实现的是鼠标放到Text文本框里按下键盘任何一个按钮就能在Text1里显示出对应的Alias码!列如我输入1就显示49
Text2 是显示对应的KeyDown识别的案件字符 列如a就显示A或a 尝试了很多次了就是不行!!各位谁看到知道的给个列子!谢谢了!!!!!
!
工程1.rar
(1.85 KB)
方便各位老师了!现成的附件!帮我改改谢谢了