Microsoft Foundation Classes (mfc.hlp) (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CWnd::OnCompareItem
CWnd                                        Up Contents Index Back
──Microsoft Foundation Classes──────────────────────────────────────────────
 
  afx_msg int OnCompareItem ( LPCOMPAREITEMSTRUCT  lpCompareItemStruct  );
 
  Parameter             Description
 
  <lpCompareItemStruct> Contains a long pointer to a COMPAREITEMSTRUCT
                        data structure that contains the identifiers and
                        application-supplied data for two items in the
                        combo or list box.
 
  Remarks
 
  Override this member function in your derived class to handle the
  WM_COMPAREITEM message.
 
  Use the overridden member function to specify the relative position of a
  new item in a sorted owner-draw combo or list box.
 
  If a combo or list box is created with the CBS_SORT or LBS_SORT
  style, Windows sends the combo-box or list-box owner a WM_COMPAREITEM
  message whenever the application adds a new item.
 
  The <lpCompareItemStruct> parameter is a long pointer to a
  COMPAREITEMSTRUCT data structure that contains the identifiers and
  application-supplied data for two items in the combo or list box.
  OnCompareItem should return a value indicating which of the items should
  appear before the other. Typically, Windows makes this call several
  times until it determines the exact position for the new item.
 
  This message-handler member function calls the Default member
  function.
 
  Return Value
 
  Indicates the relative position of the two items. It may be any of the
  following values:
 
  Value   Meaning
 
  -1      Item 1 sorts before item 2.
 
  0       Item 1 and item 2 sort the same.
 
  1       Item 1 sorts after item 2.
 
  See Also
 
  COMPAREITEMSTRUCT, WM_COMPAREITEM, CWnd::Default
 
 
                                     -♦-