views:

186

answers:

1

I am writing a C# application that needs to extract data from a ListView control that resides in an external process.

I already have the code to extract data and get the number of items in a ListView but I need the equivalent of the following for sub items:

    public int GetListViewRowCount()
    {
        if (list_view_handle != null)
        {
            return (int)UnManagedMethods.SendMessage(list_view_handle,
                (int)UnManagedMethods.W32_LVM.LVM_GETITEMCOUNT,
                IntPtr.Zero, IntPtr.Zero);
        }
        else return 0;
    }

I'm basically looking for the functionality provided by a LVM_GETSUBITEMCOUNT type message.

+1  A: 

You need to send LVM_GETITEM (to the other process) each time increasing the size of iSubItem until you get FALSE.
Don't forget that the pointer to pItem needs to valid in the other process, so you need to use methods of allocation memory on different process. Here is the link that I used in the past.

Shay Erlichmen