通过SendMessage获取LVGROUP结构中的ListView组信息 [英] Get ListView Group information in an LVGROUP struct through SendMessage

查看:54
本文介绍了通过SendMessage获取LVGROUP结构中的ListView组信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

基本上,我想用有关第一个ListView组的信息来恢复LVGROUP.

简而言之,这是我尝试过的操作:

Basicly i want to get the LVGROUP back with information about the first ListView Group

in short heres what i tried:

    [DllImport("User32.dll")]

    internal static extern int SendMessage(IntPtr hWnd, int Msg, int wParam, out LVGROUP lParam);    

    const int LVM_FIRST = 0x1000;
const int LVM_GETGROUPINFO = (LVM_FIRST+149)
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)] public struct LVGROUP { public int CbSize; public ListViewGroupMask Mask; [MarshalAs(UnmanagedType.LPWStr)] public string PszHeader; public int CchHeader; [MarshalAs(UnmanagedType.LPWStr)] public string PszFooter; public int CchFooter; public int IGroupId; public int StateMask; public ListViewGroupState State; public uint UAlign; public IntPtr PszSubtitle; public uint CchSubtitle; [MarshalAs(UnmanagedType.LPWStr)] public string PszTask; public uint CchTask; [MarshalAs(UnmanagedType.LPWStr)] public string PszDescriptionTop; public uint CchDescriptionTop; [MarshalAs(UnmanagedType.LPWStr)] public string PszDescriptionBottom; public uint CchDescriptionBottom; public int ITitleImage; public int IExtendedImage; public int IFirstItem; public IntPtr CItems; public IntPtr PszSubsetTitle; public IntPtr CchSubsetTitle; } public LVGROUP GetLvG()
{
LVGROUP g = new LVGROUP(); g.CbSize = Marshal.SizeOf(typeof(LVGROUP));
        g.IGroupId = 0; SendMessage(mylistview.Handle, LVM_GETGROUPINFO, 0, out g);
return g;
}

推荐答案

您是否也要使用组掩码?

看看这个可折叠ListViewGroup 示例,可能会有所帮助(它们可在Vista上运行,但那只应该是关于可折叠部分)

Shouldn't you use group mask as well?

Look at this Collapsible ListViewGroup example, might help (their works on Vista and further but that should be about the collapsible part only)


这篇关于通过SendMessage获取LVGROUP结构中的ListView组信息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆