windowsapiinter-process-communicatsyslistview32

Read listview data from another process


This is a kind of GUI automation application whereby I want to read the data from a listview from another process.

The listview class is SysListView32 and has following styles set LVS_OWNERDRAWFIXED

Generally I am able to read the text from listview using the following procedure

It works fine when the listview is not ownerdrawn but in this case, the listview appears to be drawn by the owner, i.e. the listitem has no data.

Is it possible to read the text from such a listview either by the method I have discussed or by any method or by hooking the api or whatsoever method ?


Solution

  • The control must still add LVITEMs to the list view. But of course there's no obligation to put anything useful in them. Specifying a null pszText or iImage would work just fine if the app does its own drawing. It will implement a WM_DRAWITEM message handler and use internal data to render the item.

    There is no way to find out where that data is stored. You could fake your own WM_DRAWITEM message, albeit that it is very hard to do since you must inject code to create the HDC, but that just gets you pixels, not bytes. Using OCR would be a major outlier solution. Realistically you'll need to throw in the towel on this one.