重载CompareItem:typedef struct tagCOMPAREITEMSTRUCT { 
  UINT      CtlType; 
  UINT      CtlID; 
  HWND      hwndItem; 
  UINT      itemID1; 
  ULONG_PTR itemData1; 
  UINT      itemID2; 
  ULONG_PTR itemData2; 
  DWORD     dwLocaleId;
} COMPAREITEMSTRUCT; 
example:int CColorListBox::CompareItem(LPCOMPAREITEMSTRUCT lpCIS)
{
COLORREF cr1 = (COLORREF)lpCIS->itemData1;
COLORREF cr2 = (COLORREF)lpCIS->itemData2;
if (cr1 == cr2)
return 0;       // exact match // first do an intensity sort, lower intensities go first
int intensity1 = GetRValue(cr1) + GetGValue(cr1) + GetBValue(cr1);
int intensity2 = GetRValue(cr2) + GetGValue(cr2) + GetBValue(cr2);
if (intensity1 < intensity2)
return -1;      // lower intensity goes first
else if (intensity1 > intensity2)
return 1;       // higher intensity goes second // if same intensity, sort by color (blues first, reds last)
if (GetBValue(cr1) > GetBValue(cr2))
return -1;
else if (GetGValue(cr1) > GetGValue(cr2))
return -1;
else if (GetRValue(cr1) > GetRValue(cr2))
return -1;
else
return 1;
}