简体   繁体   English

给定(纯win32)列表视图的HWND,我如何获取其项目?

[英]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 . 这涉及对OpenProcessVirtualAllocExWriteProcessMemoryReadProcessMemory调用。 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.

相关问题 给定 HWND,如何获取窗口的子窗口? - How can I get the child windows of a window given its HWND? 如何从其 Win32 句柄中获取 System.Windows.Form 实例? - How do I get a System.Windows.Form instance from its Win32 handle? 如何在Win32应用程序中使用winappdriver获得子元素的列表? - How do I get a list of child elements using winappdriver in a win32 application? 如何在C#/ Win32中获取正在运行的进程的DOS路径名? - How can I get the DOS path name of a running process in C# / Win32? 如何在 UWP 中获得对 StorageFile 或 StorageFolder 的 FILE_WRITE_ATTRIBUTES 访问权限的 Win32 HANDLE? - How can I get a Win32 HANDLE with FILE_WRITE_ATTRIBUTES access for a StorageFile or StorageFolder in UWP? 如何从C#中使用Win32获得可访问的名称? - How can I get the accessible name using win32 from c#? 如何更改win32窗口上的文本? - How can I change text on a win32 window? 启动 Win32 进程 A,它启动进程 B--获取 B 的 ID / HWND - Start Win32 process A which starts process B--get ID / HWND for B 有没有办法设置一个win32控件hwnd,使其无法调整大小或移动? - Is there a way to set a win32 control hwnd so that it can't be resized or moved? 我可以在 win32 应用程序中使用 WPF 吗? - Can I use WPF in win32 application?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM