VB发送后台按键消息

2024-12-03 14:22:08
推荐回答(1个)
回答1:

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 LongPublic Declare Function SendKeys(ByVal hwnd As long,ByVal keycode as long)
PostMessage hwnd,256,keycode,0
End function这样就可以调用(你可以用计算器的窗口句柄试一下):SendKeys(hWnd,asc("1"));