c# - 如何从 Windows 应用程序中抓取数据网格

标签 c# datagrid screen-scraping user32

我正在尝试从 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 返回任何值。

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

最佳答案

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

关于c# - 如何从 Windows 应用程序中抓取数据网格,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11393875/

相关文章:

c# - 以编程方式添加 Web 控件时的回发问题

C# 无法从 Azure Key Vault 检索 secret

wpf - 在 DataGridTextColumn 中为 TextBlock 创建样式

datagrid - Dojo Datagrid:如何更改第一行的样式?

python - 404 HTTP 错误,尽管能够在浏览器中看到该页面

php - 截屏你一生中见过的最丑陋的 HTML

c# - 环回/本地主机问题

c# - "try"应该在资源分配之前还是之后?

java - 如何在 Java Web 应用程序中显示表格数据

javascript - 如何使用 node.js 和 javascript 模仿 Facebook 的 "link share"功能