Reading an External ListView

kylegee

Member
Joined
Sep 9, 2008
Messages
10
Programming Experience
Beginner
I need to copy the text from the listview of another program. How can I do that?

I am making a program that will have to interact will all sorts of controls of external programs.

Are there any resources around that are geared specifically towards writing these types of methods?

Thanks in advance.
 
First up you'll need to get a handle (hWnd) to the parent window of the ListView (FindWindowEx). Now from here i'd go the Win32 route but it's possible (though I haven't tried it) you could use the Control.FromHandle. Once you have an instance of the control class from the parent windows handle you may be able to cast it to a Form. Seeing as controls are all MarshalByRef Objects effectively you'll have a pointer on the managed heap to the Parent window.. From there you should have no problem getting the info from the ListView. I have to say this Control.FromHandle thing sounds a bit dodge in my head but it's worth a try to see if it works. However if it doesn't you can use EnumChildWindows to get a handle to the ListView then it's just a matter of copying the items.
 
Back
Top