BCGControlBar Pro for MFC
void CBCGPHeaderCtrl::SetSortColumn ( int  iColumn,
BOOL  bAscending = TRUE,

Sets the current sorted column and its sort order.

Call this member function to set the current sorted column and the sort order. The header control will display the sort arrow according to this information.

If bAdd is TRUE this column will be added to the list of sort columns. The header control must be multiple sorted, otherwise the library asserts in debug mode. If bAdd is FALSE and the header control is in multiple sort mode, the list of sorted columns is cleared first. You can enable multiple sort using EnableMultipleSort().

If iColumn is -1, the list of sorted columns is cleared.

iColumnThe zero-based index of a header control item whose column is sorted.
bAscendingSpecifies the sort order. TRUE - ascending order, FALSE - descending order.
bAddSpecifies whether the specified column should be added to the current list of sort columns (only if the header control in the multiple sort mode).