帮忙VB一小段代码转化为delphi,谢谢哦 60
OptionExplicitPrivateDeclareFunctionGetWindowRectLib"user32"_(_ByValhWndAsLong,_lpRec...
Option Explicit
Private Declare Function GetWindowRect Lib "user32" _
( _
ByVal hWnd As Long, _
lpRect As RECT _
) As Long
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const MK_LBUTTON = &H1
Private Sub MyClick(hWnd As Long)
Dim Rc As RECT
Dim mPoint As Long
Dim X As Long
Dim Y As Long
Call GetWindowRect(hWnd, Rc)
X = (Rc.Right - Rc.Left) / 2
Y = (Rc.Bottom - Rc.Top) / 2
mPoint = (Y * &H10000) Or X
Call SendMessage(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, ByVal mPoint)
Call SendMessage(hWnd, WM_LBUTTONUP, 0, ByVal mPoint)
End Sub
对VB不懂,这些看不懂,请大侠们帮忙翻译一下,帮忙解析为delphi代码,谢谢哦 展开
Private Declare Function GetWindowRect Lib "user32" _
( _
ByVal hWnd As Long, _
lpRect As RECT _
) As Long
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 Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const MK_LBUTTON = &H1
Private Sub MyClick(hWnd As Long)
Dim Rc As RECT
Dim mPoint As Long
Dim X As Long
Dim Y As Long
Call GetWindowRect(hWnd, Rc)
X = (Rc.Right - Rc.Left) / 2
Y = (Rc.Bottom - Rc.Top) / 2
mPoint = (Y * &H10000) Or X
Call SendMessage(hWnd, WM_LBUTTONDOWN, MK_LBUTTON, ByVal mPoint)
Call SendMessage(hWnd, WM_LBUTTONUP, 0, ByVal mPoint)
End Sub
对VB不懂,这些看不懂,请大侠们帮忙翻译一下,帮忙解析为delphi代码,谢谢哦 展开
2个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询