Private Declare Function GetCursorPos Lib "user32" (lpPoint As POINTAPI) As Long
Private Declare Function WindowFromPoint Lib "user32" (ByVal xPoint As Long, ByVal yPoint As Long) 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 Const WM_GETTEXT = &HD
Private Type POINTAPI
x As Long
y As Long
End Type
Private Sub Command1_Click()
Timer1.Enabled = True
End Sub
Private Sub Timer1_Timer()
On Error Resume Next
Dim P As POINTAPI
Dim H As Long
Dim lParam As String * 256
GetCursorPos P
H = WindowFromPoint(P.x, P.y)
SendMessage H, WM_GETTEXT, 255, lParam
Text1.Text = lParam
End Sub
他说工程1中发生未处理的WIN32异常