想抓一个软件的 一个类名是Edit的输入框中的内容,句柄已经正确找到了,然后用精灵8自带的 Plugin.Window.GetText(Hwnd) 命令来获取,结果得不到输入框中的控件内容,只得到一个窗口标题 “ 1 ”。 如图示:
想获得这个输入框中的1222 这个值,上述命令,只能获得窗口标题“1”。
这个图是用精易编程助手抓到的。
有什么办法能获取输入框中 1222 这个值?
方法:
利用Win32的SendMessage API来实现
Private Declare Function SendMessage Lib "user32" Alias "SendMessageW" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As Any) As Long
TracePrint getText(69198)
Function GetText(Arg_hwnd)
Dim S_TextLen
S_TextLen = SendMessage(Arg_hwnd, &HE, 0, 0)
S_strText = Space(S_TextLen)
Call SendMessage(Arg_hwnd, &HD, S_TextLen+1, S_strText)
GetText = S_strText
End Function