BOOL fnBuildLists( CListCtrl& ctrlList )
{
        LPTSTR szColumn[] = { _T("time    ") , _T("Proto"),
                                                _T("src_addr                   "),
                                                _T("des_addr                   "),
                                                _T("size"), _T("data") };

        int nMaxCol = sizeof( szColumn )/sizeof( szColumn[0] );

        RECT rtList;
        ctrlList.GetClientRect( &rtList );
        int nWidth = (rtList.right - rtList.left )/nMaxCol;
        int nCol;
        for( nCol = 0 ; nCol < nMaxCol ; nCol ++)
                ctrlList.InsertColumn( nCol, szColumn[nCol], LVCFMT_LEFT, nWidth );

        for( nCol = 0 ; nCol < nMaxCol ; nCol ++)
                ctrlList.SetColumnWidth( nCol, LVSCW_AUTOSIZE_USEHEADER );

        // Enable the full row selection and the drag drop of headers.
        DWORD styles = LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_FLATSB;
        // Use macro since this is new and not in MFC.
        ListView_SetExtendedListViewStyleEx(ctrlList.GetSafeHwnd(), styles, styles );
        
        return TRUE;
}

+ Recent posts