VBA。从其他应用程序中检索文本

时间:2014-02-10 22:15:12

标签: excel-vba vba excel

我正在尝试从另一个应用程序中检索文本,并且只返回3个空格。 (这受到http://www.siddharthrout.com/2012/02/02/vbavb-netvb6click-opensavecancel-button-on-ie-download-window-part-ii/

的强烈启发
Ret = FindWindow(vbNullString, "koelskerN - R1Q2 b4449 (port 27910)")

If Ret <> 0 Then
    ChildRet = FindWindowEx(Ret, ByVal 0&, "Edit", vbNullString)

    strBuff = String(GetWindowTextLength(ChildRet) + 1, Chr$(0))
    GetWindowText ChildRet, strBuff, Len(strBuff)
    ButCap = strBuff

    debug.print strBuff 'Is just returning 3. blank spaces)
End If

Spy++ and application

Ret return = 8062086 ChildRet返回= 9309970

之前我还没有尝试过使用FindWindow,所以我很欣赏一些关于如何从内部和编辑类中提取文本的指南。

1 个答案:

答案 0 :(得分:0)

我发现,应用程序有一个日志文件1,它将所有内容提取到.txt文件中。这个问题已经解决了。

相关问题