共用方式為


CMFCListCtrl::OnCompareItems

The framework calls this method when it compares two items.

virtual int OnCompareItems(
   LPARAM lParam1,
   LPARAM lParam2,
   int iColumn 
);

Parameters

  • [in] lParam1
    The first item to compare.

  • [in] lParam2
    The second item to compare.

  • [in] iColumn
    The index of the column that this method is sorting.

Return Value

An integer that indicates the relative position of the two items. A negative value indicates that the first item should precede the second, positive value indicates that the first item should follow the second, and zero means that the two items are equivalent.

Remarks

The default implementation always returns 0. You must override this function to provide a sorting algorithm.

Requirements

Header: afxlistctrl.h

See Also

Reference

CMFCListCtrl Class

Hierarchy Chart