BCGControlBar Pro for MFC
int CBCGPGridCtrl::SortChildRowsCB ( CBCGPGridRow pParent,
PFNTVCOMPARE  pfnCompare,
LPARAM  lParamSort 
)

Sorting child rows at one level of hierarchy using the callback function.

Call this member function to immediately sort all children of the specified row in the grid control. The method uses the callback function. 

The callback Compare function is a static function that has the following prototype:

int CALLBACK Compare (LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort);

Where

LPARAM lParam1: a pointer to row1 (CBCGPGridRow*) to be compared. LPARAM lParam2: a pointer to row2 (CBCGPGridRow*) to be compared.

LPARAM lParamSort is a parameter value that is passed to CBCGPGridCtrl::SortChildRowsCB.

The callback Compare function returns -1 if row1 < row2; 1, if row1 > row2; and 0, if row1 equals row2. Since the implementation may use the QSORT algorithm, it may change the order of equal elements.

Parameters
pParentA pointer to the grid row
pfnCompareA pointer to a callback function to compare two rows. During the sort, the callback function is repeatedly invoked as two items from the grid control are selected for comparison.
lParamSortA user-defined value that is passed as a parameter to each call of the callback function.
Returns
A number of the sorted rows.