VB SendMessage WM_KEYDOWN/WM_KEYUP为何无法发送按键
PrivateDeclareFunctionSendMessageLib"user32"Alias"SendMessageA"(ByValhwndAsLong,ByVal...
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long
Private Const WM_CHAR = &H102
Private Const WM_KEYDOWN = &H100
Private Const VK_R = &H52
Private Const WM_KEYUP = &H101
Private Sub Command1_Click()
SendMessage Text1.hwnd, WM_KEYDOWN, 13, 0&
SendMessage Text1.hwnd, WM_KEYUP, 13, 0&
End Sub
点了为何text1里面没有出现回车?
如果使用
SendMessage Text1.hwnd, WM_CHAR, 13, 0&
就会有无数个回车发到text1里面,最终死循环~
有人说吧0改成1就是发送一个,但是无效还是无限回车
请高手回答
PostMessage 可以举例吗? 展开
Private Const WM_CHAR = &H102
Private Const WM_KEYDOWN = &H100
Private Const VK_R = &H52
Private Const WM_KEYUP = &H101
Private Sub Command1_Click()
SendMessage Text1.hwnd, WM_KEYDOWN, 13, 0&
SendMessage Text1.hwnd, WM_KEYUP, 13, 0&
End Sub
点了为何text1里面没有出现回车?
如果使用
SendMessage Text1.hwnd, WM_CHAR, 13, 0&
就会有无数个回车发到text1里面,最终死循环~
有人说吧0改成1就是发送一个,但是无效还是无限回车
请高手回答
PostMessage 可以举例吗? 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询