【问题标题】:How to scrape datagrid from a Windows Application如何从 Windows 应用程序中抓取数据网格
【发布时间】:2012-07-08 18:46:10
【问题描述】:

我正在尝试从 Windows 应用程序内的数据网格中抓取数据。

我已使用 User32.dll 及其方法(如 GetWindow)成功地从应用程序的文本框中抓取数据以查找句柄,然后使用 SendMessage 读取内容。

[DllImport("user32.dll", EntryPoint = "GetWindow", SetLastError = true)]
    internal static extern IntPtr GetWindow(IntPtr lpWindHandle, uint lpWindowName);

[DllImport("user32.dll", SetLastError = true)]
    public static extern bool SendMessage(IntPtr hWnd, uint Msg, int wParam, StringBuilder lParam);

我的问题是这些方法似乎没有为DataGridtable 返回任何值。

有人对我如何实现这一目标有任何建议吗?

【问题讨论】:

    标签: c# datagrid screen-scraping user32


    【解决方案1】:

    这可以通过使用 UI 自动化 API 来实现。我希望这些链接可以帮助您找到所需的解决方案:Discussion of similar problem,UI Automation Support for the DataGrid Control Type。虽然具体的解决方案取决于datagrid的很多实现细节。

    【讨论】:

    • 干杯亚历克斯,现在看看这些链接。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-03
    • 2018-10-13
    • 2021-01-13
    相关资源
    最近更新 更多