1,486
社区成员
发帖
与我相关
我的任务
分享
Dim ButtonText As String * 256
str = GetWindowText(ChildText_Hwnd, ByVal ButtonText, 255)
MsgBox ButtonText
'发一个WM_GETTEXT 消息就够了
Option Explicit
Private Declare Function SendMessage Lib "user32.dll" Alias "SendMessageA" (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByRef lParam As Any) As Long
Private Const WM_GETTEXT As Long = &HD&
Private Sub Command1_Click()
Dim ButtonText As String * 256
Call SendMessage(Command1.hWnd, WM_GETTEXT, 255, ByVal ButtonText)
Debug.Print "Button按钮文本:" & Left(ButtonText, InStr(ButtonText, Chr(0)) - 1)
End Sub