- Notifications
You must be signed in to change notification settings - Fork 961
/
Copy pathccombobox-class_4.cpp
25 lines (23 loc) · 844 Bytes
/
ccombobox-class_4.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// CMyComboBox is my owner-drawn combo box derived from CComboBox. This
// example compares two items using strcmp to sort items in reverse
// alphabetical order. The combo box control was created with the
// following code:
// pmyComboBox->Create(
// WS_CHILD|WS_VISIBLE|WS_BORDER|WS_HSCROLL|WS_VSCROLL|
// CBS_SORT|CBS_OWNERDRAWVARIABLE,
// myRect, pParentWnd, 1);
//
intCMyComboBox::CompareItem(LPCOMPAREITEMSTRUCT lpCompareItemStruct)
{
int iComp = 0;
ASSERT(lpCompareItemStruct->CtlType == ODT_COMBOBOX);
LPCTSTR lpszText1 = (LPCTSTR)lpCompareItemStruct->itemData1;
ASSERT(lpszText1 != NULL);
LPCTSTR lpszText2 = (LPCTSTR)lpCompareItemStruct->itemData2;
ASSERT(lpszText2 != NULL);
if (NULL != lpszText1 && NULL != lpszText2)
{
iComp = _tcscmp(lpszText2, lpszText1);
}
return iComp;
}