C
C
client242015-09-20 17:07:45
.NET
client24, 2015-09-20 17:07:45

How to get data from ListView which is in another program?

I try to do so

LVITEM lvi = new LVITEM();
lvi.mask = WinAPI.LVIF_TEXT;
lvi.cchTextMax = 512;
lvi.iItem = 1;
lvi.iSubItem = 0;

lvi.pszText = Marshal.AllocHGlobal(512);
IntPtr ptrLvi = Marshal.AllocHGlobal(Marshal.SizeOf(lvi));
            
Marshal.StructureToPtr(lvi, ptrLvi, false);

SendMessage(hListView, LVM_GETITEM, IntPtr.Zero, ptrLvi);

string itemText = Marshal.PtrToStringAuto(lvi.pszText);

Always comes something like "蕘Ѽ涸Ѻ"

Answer the question

In order to leave comments, you need to log in

1 answer(s)
O
om2804, 2015-09-23
@client24

Severely :)
Look towards interprocess communication. For example the Mutex class

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question