You won't be able to get the items one at a time in the external listview. you have to understand process / memory bounds. sure, the GET_ITEM call of a listbox works with an external app, but the same is not the case when it comes to a listview, treeview, or any other control which did not exist under Windows 3.1. if you want the answer as to why this is the case, then do some research -- it will help you out in the long run

in anycase, i think using the function is relatively self explanatory. you send in a handle to a listview, the process ID of the foreign executable, and the row/column you want the item text for. looking at your code, you have almost all of that information already -- have for maybe the process ID. do a bit of research and you'll find how you can obtain the process ID from an hWnd -- if you're still stuck, reply back and I'll help.

You wanted an explanation of how the function works -- well, here it goes :

basically, the function allocates an LV_ITEM structure (in 'C' speak), ie: notice that the pszText item is a long, and not a VB string variable. This is the case because relatively speaking, strings in C are arrays of characters, and by default - windows is expecting a pointer to an array or chars (thus the long). Also, since you need to send in the length of the LV_ITEM structure into the WriteProcessMemory call, you can't use an open ended / nondefined length such as an un-initialized Vb String.

Since the ListView you are querying is in an external process, the recieving program will not properly be able to process your SendMessage command since the memory location of the structure you are sending in (for it to fill out) resides outside of its own memory scope. Thus, you need to "create" the structure in its own memory scope so that it can properly "fill it in". After it is "filled in", you need to have windows re-create that strure within the memory scope of your application -- so you can read it.

Basically, the gist of it is that any given process *cannot* access/modify memory locations outside of its scope. The Listbox, Textbox and certain other controls which can be utilized with SendMessage and which existed under Windows 3.1 are exceptions to this rule. Do your homework and report back to me tomorrow with you answer as to why this is the case.

As it stands, you should be able to "copy/paste" my code into your program and make it do what you want it to -- not that I am advocating this approach towards VB coding, but it attempting to implement my code might serve as a learning experience for you.

I think that too often people who read these forums take things for granted, and consider themselves "experts" without knowing a damn **** about what they are copying/pasting.

- hax