主题:求助SendMessage命令的用法
我想发送一个按键到一个程序
SendMessage hwd, &H100, &H70, 0& '按住F1键,&H100代表按下,&H70代表F1
SendMessage hwd, &H101, &H70, 0& '松开F1键,&H101代表松开,&H70代表F1
Sleep Val(Text2.Text)
hwd是这个程序的ID已经证实没有问题
添加了一个模块
'发送信息的函数
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'延迟函数
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
不知道是不是正确的
SendMessage hwd, &H100, &H70, 0& '按住F1键,&H100代表按下,&H70代表F1
SendMessage hwd, &H101, &H70, 0& '松开F1键,&H101代表松开,&H70代表F1
Sleep Val(Text2.Text)
hwd是这个程序的ID已经证实没有问题
添加了一个模块
'发送信息的函数
Public Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
'延迟函数
Public Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
不知道是不是正确的