c# - Get listview from third party application -
i'm trying listview third party application, here's how i'm trying accomplish this
[dllimport("user32.dll", charset = charset.auto, setlasterror = false)] static extern intptr sendmessage(intptr hwnd, uint msg, intptr wparam, stringbuilder lparam); const int lvm_getitemcount = 0x018b; const int lvm_getitemtext = 0x0189; // listbox contents hwnd private list<string> getlistviewcontents(intptr listviewhwnd) { int cnt = (int)sendmessage(listviewhwnd, lvm_getitemcount, intptr.zero, null); list<string> listviewcontents = new list<string>(); (int = 0; < cnt; i++) { stringbuilder sb = new stringbuilder(256); intptr gettext = sendmessage(listviewhwnd, lvm_getitemtext, (intptr)i, sb); listviewcontents.add(sb.tostring()); } return listviewcontents; }
then use uispy handle listview property on application , use following code populate applications listbox:
intptr ks = new intptr(0x00040fa8); // temp handle 3rd party listview listbox1.datasource = getlistviewcontents(ks);
no data returned, problem?
you passing stringbuffer expecting particular structure, per http://msdn.microsoft.com/en-us/library/windows/desktop/bb761055(v=vs.85).aspx
you should take @ getting text syslistview32 in 64bit
Comments
Post a Comment