bool CSetDlgLists::GetListBoxItem(HWND hWnd, WORD nCtrlId, eWordItems eWhat, UINT& nValue) { bool bFound = false; const DWORD* pnValues; uint nItems = GetListItems(eWhat, pnValues); HWND hList = nCtrlId ? GetDlgItem(hWnd, nCtrlId) : hWnd; _ASSERTE(hList!=NULL); INT_PTR num = SendMessage(hList, CB_GETCURSEL, 0, 0); //int nKeyCount = countof(CSetDlgLists::szKeys); if (num>=0 && num<(int)nItems) { nValue = pnValues[num]; //-V108 bFound = true; } else { nValue = pnValues[0]; if (num) // Invalid index? SendMessage(hList, CB_SETCURSEL, num=0, 0); } return bFound; }
void CSetDlgLists::FillListBoxItems(HWND hList, eWordItems eWhat, UINT& nValue, bool abExact) { const DWORD* pnValues; uint nItems = GetListItems(eWhat, pnValues); _ASSERTE(hList!=NULL); uint num = 0; wchar_t szNumber[32]; SendMessage(hList, CB_RESETCONTENT, 0, 0); for (uint i = 0; i < nItems; i++) { _wsprintf(szNumber, SKIPLEN(countof(szNumber)) L"%u", pnValues[i]); SendMessage(hList, CB_ADDSTRING, 0, (LPARAM)szNumber); if (pnValues[i] == nValue) num = i; } if (abExact) { _wsprintf(szNumber, SKIPLEN(countof(szNumber)) L"%u", nValue); SelectStringExact(hList, 0, szNumber); } else { if (!num) nValue = 0; // если код неизвестен? SendMessage(hList, CB_SETCURSEL, num, 0); } }
void CSetDlgLists::FillListBoxItems(HWND hList, eFillListBoxItems eWhat, UINT& nValue, bool abExact) { const ListBoxItem* Items; uint nItems = GetListItems(eWhat, Items); _ASSERTE(hList!=NULL); int num = -1; wchar_t szNumber[32]; SendMessage(hList, CB_RESETCONTENT, 0, 0); for (uint i = 0; i < nItems; i++) { SendMessage(hList, CB_ADDSTRING, 0, (LPARAM) Items[i].sValue); //-V108 if (Items[i].nValue == nValue) num = i; //-V108 } if ((num != -1) || !abExact) { // если код не валиден if (num == -1) { nValue = 0; num = 0; } SendMessage(hList, CB_SETCURSEL, num, 0); } else { _wsprintf(szNumber, SKIPLEN(countof(szNumber)) L"%i", nValue); SelectStringExact(hList, 0, szNumber); } }
void CSetDlgLists::FillListBox(HWND hList, WORD nCtrlId, eFillListBoxItems eWhat) { const ListBoxItem* Items; uint nItems = GetListItems(eWhat, Items); SendMessage(hList, CB_RESETCONTENT, 0, 0); for (uint i = 0; i < nItems; i++) { SendMessage(hList, CB_ADDSTRING, 0, (LPARAM)Items[i].sValue); //-V108 } }
void CSetDlgLists::EnableDlgItems(HWND hParent, eWordItems eWhat, BOOL bEnabled) { const DWORD* pnValues; uint nItems = GetListItems(eWhat, pnValues); EnableDlgItems(hParent, pnValues, nItems, bEnabled); }
bool Pop3::GetMessageUniqueIds(ValueMap& uids) { if(!PutGet("UIDL\r\n", true)) return false; return GetListItems(uids, INT_V, STRING_V); }
bool Pop3::GetMessageList(ValueMap& list) { if(!PutGet("LIST\r\n", true)) return false; return GetListItems(list, INT_V, INT_V); }