How can i get HWND of external application's listview? In Windows Api using c++

Posted by Marko29 on Stack Overflow See other posts from Stack Overflow or by Marko29
Published on 2010-12-31T00:36:51Z Indexed on 2010/12/31 0:54 UTC
Read the original article Hit count: 277

Filed under:
|
|

So i am trying to make app to get content of my explorer listviews and get item text etc.. from it but here are the problems...

If i inspect windows explorer folder(using spy++) with listview, just for testing purposes i will use random folder.

It shows me that caption of the window is "FolderView" with class "SysListView32" and the top level window where this listview is nested is called "reference", this is also the title of windows explorer folder where all the files are.

So what i do is..

HWND hWndLV = FindWindow(NULL, TEXT("reference")); // first i get hwnd of the main window, this is where listview window is also nested according to spy++, thats why i do this first.

HWND child = FindWindowEx(hWndLV, NULL,NULL,TEXT("FolderView")); // trying to get hwnd of the listview here but it fails, same happens if i also put the class name along as

HWND child = FindWindowEx(hWndLV, NULL,TEXT("SysListView32"),TEXT("FolderView"));

I am using bool test = IsWindow(child); to test for fail, also VS debugger shows 0x0000000000 each time so i am sure i am reading results well.

So i am stuck on this probably simple thing for most of people:(

p.s. i am on vista64(if that matters anyhow)

edit: It appears that this function works only if i search the first nested level of a parent window i am searching. So i assume what i need is a way to get handle with some sort of deep nested level search.

I also tried to go step by step by defining hwnd of every parent then i use findwindowex on it but oh boy then i get to the point where there are 5 nested windows all with the same name and only one of them contains my listview, so nice uh?

© Stack Overflow or respective owner

Related posts about c++

Related posts about Windows