vb sendmessage 问题,为什么代码没有反应。
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, lParam As Any) As Long
Private Declare Function FindWindowEx Lib "USER32" Alias "FindWindowExA" (ByVal Hwnd1 As Long, ByVal Hwnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Sub Macro1()
Dim Hwnd1 As Long
Dim Hwnd2 As Long
Hwnd1 = FindWindow(vbNullString, "无标题 - 记事本")
Hwnd2 = FindWindowEx(Hwnd1, 0, "EDIT", vbNullString)
SendMessage Hwnd2, WM_LBUTTONDOWN, 0, 0
SendMessage Hwnd2, WM_LBUTTONUP, 0, 0
End Sub
求指出错误,各位可以试一试,真的没有反应。(解决了有额外奖赏) 展开
Private Declare Function FindWindowEx Lib "USER32" Alias "FindWindowExA" (ByVal Hwnd1 As Long, ByVal Hwnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Public Declare Function FindWindow Lib "USER32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Sub Macro1()
Dim Hwnd1 As Long
Dim Hwnd2 As Long
Hwnd1 = FindWindow(vbNullString, "无标题 - 记事本")
Hwnd2 = FindWindowEx(Hwnd1, 0, "EDIT", vbNullString)
SendMessage Hwnd2, WM_LBUTTONDOWN, 0, 0
SendMessage Hwnd2, WM_LBUTTONUP, 0, 0
End Sub
求指出错误,各位可以试一试,真的没有反应。(解决了有额外奖赏) 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询