展开全部
Private Declare Function PostMessage Lib "user32" Alias "PostMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long Const WM_KEYDOWN = &H100 Const WM_KEYUP = &H101 Const WM_CHAR = &H102 Const VK_F1 = &H70 Private Sub SendF1()'调用这个过程即可对目标窗体发送F1键 Call PostMessage(hwnd, WM_KEYDOWN, VK_F1, 0) Call PostMessage(hwnd, WM_KEYUP, VK_F1, 0) End Sub 追问: 不错 好使 我再问一下在哪里表示的F1,如果要F2\F3呢? 回答: Const VK_F1 = &H70'首先要声明VK_F1 Call PostMessage(hwnd, WM_KEYDOWN, VK_F1 , 0) Call PostMessage(hwnd, WM_KEYUP, VK_F1 , 0) F2,F3是: Const VK_F2 = &H71 Const VK_F3 = &H72
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询