Programming: List Control with that fantastic Groups (WinXP) as in DVD Shrink

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Christoph_K
    Junior Member
    Junior Member
    • Apr 2004
    • 1

    Programming: List Control with that fantastic Groups (WinXP) as in DVD Shrink

    Hello!
    I'm a programmer, i am programming C/C++ WinAPI ...
    My question is:
    how i can add these wonderful "Groups" in a ListView Control?

    I wrote this function:

    void ListView_InsertGroupEx(HWND hListView, const char *szHeader, int iID)
    {
    ListView_EnableGroupView(hListView, true);

    LVGROUP lvg;
    lvg.cbSize = sizeof(LVGROUP);
    lvg.mask = LVGF_GROUPID | LVGF_ALIGN | LVGF_HEADER;
    lvg.pszHeader = L"here i want the variable szHeader. how?";
    lvg.cchHeader = wcslen(lvg.pszHeader);
    lvg.iGroupId = iID;
    lvg.uAlign = LVGA_HEADER_LEFT;

    if(ListView_InsertGroup(hListView, iID, &lvg) == -1)
    MessageBox(0, "Error Group", 0, 0);
    }

    But if i use it with:

    ListView_InsertGroupEx(GetDlgItem(hDlg, IDC_LIST), "This is the Group header 1", 0);
    ListView_InsertGroupEx(GetDlgItem(hDlg, IDC_LIST), "This is the Group header 2", 1);
    ListView_InsertGroupEx(GetDlgItem(hDlg, IDC_LIST), "This is the Group header 3", 2);

    Then there appears only ONE Group (the first one).

    WHY??
    I initialized CommonControls in my Application AND added a Manifest to use Windows XP Visual Styles. But why does it not work???

    Please help me!
Working...