本文整理汇总了C++中CComboBox::GetCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::GetCount方法的具体用法?C++ CComboBox::GetCount怎么用?C++ CComboBox::GetCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::GetCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: ShowRuleInfo
void CConfigCrossLineRule::ShowRuleInfo()
{
m_strRuleName = m_stuInfo.szRuleName;
m_bEnable = m_stuInfo.bRuleEnable;
{
CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_COMBO_DIRECT);
if (pBox)
{
int n = pBox->GetCount();
if (m_stuInfo.nDirection < n)
{
pBox->SetCurSel(m_stuInfo.nDirection);
}
}
}
{
CComboBox* pBox = (CComboBox*)GetDlgItem(IDC_COMBO_TriggerPosition);
if (pBox)
{
int n = pBox->GetCount();
if (m_stuInfo.nDirection < n)
{
pBox->SetCurSel(m_stuInfo.nTriggerPosition);
}
}
}
m_clObjType.DeleteAllItems();
if (m_clObjType.GetHeaderCtrl())
{
int nColumCount = m_clObjType.GetHeaderCtrl()->GetItemCount();
for (int i = 0; i < nColumCount; i++)
{
m_clObjType.DeleteColumn(0);
}
}
m_clObjType.SetExtendedStyle(m_clObjType.GetExtendedStyle() |
LVS_EX_HEADERDRAGDROP | LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES|LVS_EX_CHECKBOXES);
m_clObjType.InsertColumn(0, ConvertString("ObjectType"), LVCFMT_LEFT, 80, -1);
for(int i = 0; i < m_pParentWnd->m_nSupportedObjTypeNum; i++)
{
m_clObjType.InsertItem(LVIF_TEXT|LVIF_STATE,i,ConvertString(m_pParentWnd->m_gObjectTypeName[i]),0,LVIS_SELECTED,0,0);
for(int k = 0; k < m_stuInfo.nObjectTypeNum; k++)
{
if(strcmp(m_stuInfo.szObjectTypes[k], m_pParentWnd->m_gObjectTypeName[i]) == 0)
{
m_clObjType.SetCheck(i, TRUE);
break;
}
}
}
return;
}
示例2: Set
void CDlgAdminCharSkillHEAL::Set(CInfoSkillBase *pSrc)
{
int i, nNo, nCount;
DWORD dwTmp;
CComboBox *pCombo;
PCInfoSkillHEAL pSrcTmp = (PCInfoSkillHEAL)pSrc;
m_dwValue1 = pSrcTmp->m_dwValue1; /* 効果1 */
m_dwValue2 = pSrcTmp->m_dwValue2; /* 効果2 */
m_dwDistance = pSrcTmp->m_dwDistance; /* 射程距離 */
/* ヒット時の表示エフェクト */
pCombo = &m_ctlHitEffect;
nNo = 0;
nCount = pCombo->GetCount ();
for (i = 0; i < nCount; i ++) {
dwTmp = pCombo->GetItemData (i);
if (pSrcTmp->m_dwHitEffectID == dwTmp) {
nNo = i;
break;
}
}
pCombo->SetCurSel (nNo);
/* 回復種別 */
pCombo = &m_ctlHealType;
nNo = 0;
nCount = pCombo->GetCount ();
for (i = 0; i < nCount; i ++) {
dwTmp = pCombo->GetItemData (i);
if (pSrcTmp->m_dwHealType == dwTmp) {
nNo = i;
break;
}
}
pCombo->SetCurSel (nNo);
/* 範囲 */
pCombo = &m_ctlArea;
nNo = 0;
nCount = pCombo->GetCount ();
for (i = 0; i < nCount; i ++) {
dwTmp = pCombo->GetItemData (i);
if (pSrcTmp->m_dwArea == dwTmp) {
nNo = i;
break;
}
}
pCombo->SetCurSel (nNo);
UpdateData (FALSE);
}
示例3: NewGUI_ComboBox_UpdateHistory
void NewGUI_ComboBox_UpdateHistory(CComboBox& comboBox,
const std::basic_string<TCHAR>& strNew,
std::vector<std::basic_string<TCHAR> >* pvHistoryItems,
size_t dwMaxHistoryItems)
{
ASSERT(pvHistoryItems != NULL); if(pvHistoryItems == NULL) return;
if(strNew.size() > 0)
{
std::vector<std::basic_string<TCHAR> >::iterator itExists =
std::find(pvHistoryItems->begin(), pvHistoryItems->end(), strNew);
if(itExists != pvHistoryItems->end())
pvHistoryItems->erase(itExists);
size_t dwCurSize = pvHistoryItems->size();
ASSERT(dwCurSize <= dwMaxHistoryItems);
while(dwCurSize >= dwMaxHistoryItems)
{
pvHistoryItems->erase(pvHistoryItems->begin());
if(dwCurSize == pvHistoryItems->size()) { ASSERT(FALSE); break; }
dwCurSize = pvHistoryItems->size();
}
pvHistoryItems->push_back(strNew);
}
ASSERT(pvHistoryItems->size() <= dwMaxHistoryItems);
const int nOrgCount = comboBox.GetCount();
for(int n = 0; n < nOrgCount; ++n)
{
const UINT uIndex = static_cast<UINT>(nOrgCount - n - 1);
VERIFY(comboBox.DeleteString(uIndex) != CB_ERR);
}
for(size_t i = 0; i < pvHistoryItems->size(); ++i)
{
const size_t iIndex = pvHistoryItems->size() - i - 1;
comboBox.AddString(pvHistoryItems->at(iIndex).c_str());
}
if(comboBox.GetCount() > 0)
{
comboBox.AddString(HCMBX_SEPARATOR);
comboBox.AddString(HCMBX_CLEARLIST);
}
}
示例4: CComboBox_CopyTo
void CComboBox_CopyTo(const CComboBox &ctrlComboBox, CStringArray &arrstrItems)
{
ASSERT(ctrlComboBox.GetSafeHwnd() != NULL);
arrstrItems.RemoveAll();
arrstrItems.SetSize(ctrlComboBox.GetCount());
CString strItem;
for (int i = 0; i < ctrlComboBox.GetCount(); ++i)
{
ctrlComboBox.GetLBText(i, strItem);
arrstrItems[i] = strItem;
}
}
示例5: OnRestrictArrival
// Goober5000
void wing_editor::OnRestrictArrival()
{
int arrive_from_ship;
CComboBox *box;
restrict_paths dlg;
// grab stuff from GUI
UpdateData(TRUE);
if (m_arrival_location != ARRIVE_FROM_DOCK_BAY)
{
Int3();
return;
}
box = (CComboBox *) GetDlgItem(IDC_ARRIVAL_TARGET);
if (box->GetCount() == 0)
return;
arrive_from_ship = box->GetItemData(m_arrival_target);
if (!ship_has_dock_bay(arrive_from_ship))
{
Int3();
return;
}
dlg.m_arrival = true;
dlg.m_ship_class = Ships[arrive_from_ship].ship_info_index;
dlg.m_path_mask = &Wings[cur_wing].arrival_path_mask;
dlg.DoModal();
}
示例6: LoadDefaultCodec
static void LoadDefaultCodec(CAtlArray<Codec>& codecs, CComboBox& box, const GUID& cat)
{
int len = box.GetCount();
if (len >= 0) {
box.SetCurSel(0);
}
if (cat == GUID_NULL) {
return;
}
CString DisplayName = AfxGetApp()->GetProfileString(IDS_RS_CAPTURE _T("\\") + CStringFromGUID(cat), _T("DisplayName"));
for (int i = 0; i < len; i++) {
int iSel = box.GetItemData(i);
if (iSel < 0) {
continue;
}
Codec& c = codecs[iSel];
if (DisplayName == c.DisplayName) {
box.SetCurSel(i);
if (!c.pBF) {
c.pMoniker->BindToObject(NULL, NULL, __uuidof(IBaseFilter), (void**)&c.pBF);
}
break;
}
}
}
示例7: OnInitDialog
LRESULT FindView::OnInitDialog(UINT/*uMsg*/, WPARAM/*wParam*/, LPARAM/*lParam*/, BOOL&/*bHandled*/)
{
this->SetWindowText(_T("Find View"));
updateDimensionList();
CComboBox cb = GetDlgItem(IDC_DIMENSION_COMBO);
if (cb.GetCount() > 0)
{
int index = CB_ERR;
if (!m_settings->getValue(_T("DefaultDimension")).empty())
{
index = cb.FindStringExact(-1, m_settings->getValue(_T("DefaultDimension")).c_str());
}
if (index == CB_ERR)
{
index = 0;
}
cb.SetCurSel(index);
updateCharList(cb.GetItemData(index));
m_lastQueryDimension = cb.GetItemData(index);
CComboBox toon_combo = GetDlgItem(IDC_CHARCOMBO);
if (toon_combo.GetCount() > 0)
{
toon_combo.SetCurSel(0);
}
}
DlgResize_Init(false, true, WS_CLIPCHILDREN);
return 0;
}
示例8: GetFindText
int FindReplDlg::GetFindText(CComboBox& wnd, bsString& text)
{
int len;
char *tp;
int sel = wnd.GetCurSel();
if (sel == -1)
{
len = wnd.GetWindowTextLength()+1;
tp = new char[len];
wnd.GetWindowText(tp, len);
sel = wnd.FindStringExact(-1, tp);
if (sel == -1)
{
sel = wnd.InsertString(0, tp);
wnd.SetCurSel(sel);
}
int cnt;
while ((cnt = wnd.GetCount()) >= 20)
wnd.DeleteString(cnt-1);
}
else
{
len = wnd.GetLBTextLen(sel)+1;
tp = new char[len];
wnd.GetLBText(sel, tp);
}
text.Attach(tp);
return sel;
}
示例9: OnCbnSelchangeComboSource
void CEasyClientDlg::OnCbnSelchangeComboSource()
{
CComboBox* pComboxMediaSource = (CComboBox*)GetDlgItem(IDC_COMBO_SOURCE);
CComboBox* pVideoCombo = (CComboBox*)GetDlgItem(IDC_COMBO_CAMERA) ;
CComboBox* pComboxAudioSource = (CComboBox*)GetDlgItem(IDC_COMBO_MIC) ;
CEdit* pEdtRtspSource = (CEdit*)GetDlgItem(IDC_EDIT_SREAM_URL);
if (NULL == pComboxMediaSource) return;
int iCount = pComboxMediaSource->GetCount();
int iSel = pComboxMediaSource->GetCurSel();
if (iSel == 0)
{
pVideoCombo->EnableWindow(TRUE);
pComboxAudioSource->EnableWindow(TRUE);
pEdtRtspSource->SetReadOnly(TRUE);
}
else
{
pVideoCombo->EnableWindow(FALSE);
pComboxAudioSource->EnableWindow(FALSE);
pEdtRtspSource->SetReadOnly(FALSE);
}
// if (NULL != pComboxAudioSource) pComboxAudioSource->ShowWindow(iSel == iCount-1?SW_HIDE:SW_SHOW);
// if (NULL != pEdtRtspSource) pEdtRtspSource->ShowWindow(iSel == iCount-1?SW_SHOW:SW_HIDE);
//
}
示例10: OnRestrictDeparture
// Goober5000
void wing_editor::OnRestrictDeparture()
{
int depart_to_ship;
CComboBox *box;
restrict_paths dlg;
// grab stuff from GUI
UpdateData(TRUE);
if (m_departure_location != DEPART_AT_DOCK_BAY)
{
Int3();
return;
}
box = (CComboBox *) GetDlgItem(IDC_DEPARTURE_TARGET);
if (box->GetCount() == 0)
return;
depart_to_ship = box->GetItemData(m_departure_target);
if (!ship_has_dock_bay(depart_to_ship))
{
Int3();
return;
}
dlg.m_arrival = false;
dlg.m_ship_class = Ships[depart_to_ship].ship_info_index;
dlg.m_path_mask = &Wings[cur_wing].departure_path_mask;
dlg.DoModal();
}
示例11: OnBnClickedConnectCheck
//===========================================================================
void CFAVConnectDlg::OnBnClickedConnectCheck()
//===========================================================================
{
// TODO: Add your control notification handler code here
CArray<CString,CString> strArrayCOM;
UINT uPortCount;
CComboBox* pCbox = (CComboBox*)GetDlgItem(IDC_CONNECT_COMSEL);
CString strCOMPORT;
if(m_bCOMSel){
GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(FALSE);
m_bGetSerialPort = FALSE;
for(UINT i = pCbox->GetCount(); i > 0; i--){
pCbox->DeleteString(i-1);
}
m_bCOMSel = FALSE;
}
else{
if(!m_bGetSerialPort){
m_bGetSerialPort = TRUE;
uPortCount = m_UARTComm.GetSerialPort(TRUE, strArrayCOM);
for(UINT i = 0; i < uPortCount; i++){
strCOMPORT = strArrayCOM.GetAt(m_UARTComm.GetCOMIndex(i));
pCbox->InsertString(i,strCOMPORT);
}
pCbox->SetCurSel(0);
}
GetDlgItem(IDC_CONNECT_COMSEL)->EnableWindow(TRUE);
m_bCOMSel = TRUE;
}
}
示例12: CComboBox_Clear
void CComboBox_Clear(CComboBox &ctrlComboBox)
{
ASSERT(ctrlComboBox.GetSafeHwnd() != NULL);
if (ctrlComboBox.GetSafeHwnd() == NULL)
return;
for (int i = ctrlComboBox.GetCount() - 1; i >= 0; i--)
ctrlComboBox.DeleteString(i);
}
示例13: FindComboItemByData
//------------------------------------------------------------------------------
//
//------------------------------------------------------------------------------
int FindComboItemByData ( CComboBox & ComboBox, DWORD Value )
{
for ( int i = 0; i < ComboBox.GetCount (); ++i )
{
if (ComboBox.GetItemData (i) == Value)
return i;
}
return CB_ERR;
}
示例14: SelectCombo
void CEditListEditor::SelectCombo(LPCTSTR strValue, CComboBox& combo)
{
for (int i = 0; i < combo.GetCount(); i++) {
CString strTemp;
combo.GetLBText(i, strTemp);
if (strTemp == strValue) {
combo.SetCurSel(i);
break;
}
}
}
示例15: ClearComboBox
void ClearComboBox(CComboBox &stComboBox)
{
stComboBox.Clear();
{
int n = stComboBox.GetCount();
for (int i=0; i<n; i++)
{
stComboBox.DeleteString(0);
}
}
}