Exemplo n.º 1
0
        public string GetItemText(int item, int subItem)
        {
            if (QueryItemText != null)
            {
                string lvtext;
                QueryItemText(item, subItem, out lvtext);
                if (lvtext != null)
                {
                    return(lvtext);
                }
            }

            LVITEMW _ms_lvi = new LVITEMW();

            _ms_lvi.mask       = ListViewItemMask.LVIF_TEXT;
            _ms_lvi.iSubItem   = subItem;
            _ms_lvi.cchTextMax = 512;
            _ms_lvi.pszText    = Marshal.AllocCoTaskMem((_ms_lvi.cchTextMax) * 2 /*Marshal.SizeOf(typeof(char))*/);
            try
            {
                SendMessage(this.Handle, ListViewMessages.LVM_GETITEMTEXT, item, ref _ms_lvi);
                return(Marshal.PtrToStringAuto(_ms_lvi.pszText, _ms_lvi.cchTextMax));
            }
            finally
            {
                Marshal.FreeCoTaskMem(_ms_lvi.pszText);
            }
        }
Exemplo n.º 2
0
        public string GetItemText(int item, int subItem)
        {
            if (QueryItemText != null)
            {
                string lvtext;
                QueryItemText(item, subItem, out lvtext);
                if (lvtext != null)
                    return lvtext;
            }

            LVITEMW _ms_lvi = new LVITEMW();
            _ms_lvi.mask = ListViewItemMask.LVIF_TEXT;
            _ms_lvi.iSubItem = subItem;
            _ms_lvi.cchTextMax = 512;
            _ms_lvi.pszText = Marshal.AllocCoTaskMem((_ms_lvi.cchTextMax) * 2 /*Marshal.SizeOf(typeof(char))*/ );
            try
            {
                SendMessage(this.Handle, ListViewMessages.LVM_GETITEMTEXT, item, ref _ms_lvi);
                return Marshal.PtrToStringAuto(_ms_lvi.pszText, _ms_lvi.cchTextMax);
            }
            finally
            {
                Marshal.FreeCoTaskMem(_ms_lvi.pszText);
            }
        }
Exemplo n.º 3
0
 static extern int SendMessage(IntPtr hWnd, ListViewMessages Msg, int wParam, ref LVITEMW lvitem);
Exemplo n.º 4
0
 extern static int PostMessage(IntPtr hWnd, ListViewMessages Msg, int wParam, ref LVITEMW lvitem);