[英]Given the HWND of a (pure win32) list view, how can I get its items?
I would like to inspect the contents of a multi-column list view that is part of another application. 我想检查另一个应用程序中包含的多列列表视图的内容。 I would like to get its rows with columns being separately accessible.
我想得到它的行与可分别访问的列。 I have the HWND of the control.
我有控件的HWND。 The listview in question is the one that commctl32.dll provides.
有问题的listview是commctl32.dll提供的。 So far I've been looking at this article but I'm a bit confused about it, and this looks like the more "arcane" parts of the WinAPI.
到目前为止,我一直在看这篇文章,但是对此我有些困惑,这看起来像WinAPI的“ arcane”部分。 Any help would be appreciated.
任何帮助,将不胜感激。
The article that you link to covers list view handling when the control is in your process. 您链接到的文章介绍了控件在过程中时的列表视图处理。 Things are complicated for a list view in a different process.
在不同的过程中,列表视图的事情很复杂。 In that scenario the messages you need involves pointers to structs, for instance pointers to
LVITEM
structs. 在这种情况下,您需要的消息包括指向结构的指针,例如,指向
LVITEM
结构的指针。 The system won't marshal these pointers across the process boundary. 系统不会跨进程边界整理这些指针。 So in order to make this work you need to allocate memory in the virtual address space of the other process.
因此,为了完成这项工作,您需要在其他进程的虚拟地址空间中分配内存。 That involves calls to
OpenProcess
, VirtualAllocEx
, WriteProcessMemory
and ReadProcessMemory
. 这涉及对
OpenProcess
, VirtualAllocEx
, WriteProcessMemory
和ReadProcessMemory
调用。 Not much fun. 没什么好玩的。 There are many examples of this process available on the web, and I don't want to add another one here.
网上有很多此过程的示例,我不想在这里添加另一个。
However, this is the wrong way to tackle the problem. 但是,这是解决问题的错误方法。 You should use one of the automation interfaces to automate this other application.
您应该使用自动化界面之一来自动化该其他应用程序。 Start by looking at UI Automation .
首先查看UI自动化 。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.