예제 #1
0
bool	CFolderSet::Initial()
{
	CComboBox* pComboPack = (CComboBox*)GetDlgItem(IDC_COMBO_PACKAGE_TYPE);	
	if( pComboPack == NULL)	return false;
	pComboPack->Clear();
	itTypeInfo it = m_PackageSets.begin();
	for(;it != m_PackageSets.end();it++)
	{
		pComboPack->AddString( (*it).strFileName.c_str());
	}
	UpdatePackSet();
	CButton* pForcePack = (CButton*)GetDlgItem(IDC_CHECK_FORCE_MODIFY_PACKTYPE);
	if(pForcePack)
		pForcePack->SetCheck(m_bForceModifyPackType);

	CComboBox* pComboCompress= (CComboBox*)GetDlgItem(IDC_COMBO_COMPRESS_TYPE);
	if(pComboCompress == NULL)	return false;
	pComboCompress->Clear();
	it = m_CompresSets.begin();
	for(;it != m_CompresSets.end();it++)
	{
		pComboCompress->AddString( (*it).strFileName.c_str());
	}
	UpdateCompressSet();
	CButton* pForceCompress = (CButton*)GetDlgItem(IDC_CHECK_FORCE_MODIFY_COMPRESSTYPE);
	if(pForceCompress)
		pForceCompress->SetCheck(m_bForceModifyCompressType);
	return true;
}
예제 #2
0
// the sub-class can call this method to fill out a combo box with the values stored in
//  the recently used list.
void CAutoConfigDlg::EnumRecentlyUsed(CComboBox& cbRecentlyUsed)
{
	cbRecentlyUsed.Clear();
	CRegKey keyRecentConverterIDs;
	CString strRegKey = GetRegKey();
	if( keyRecentConverterIDs.Open(HKEY_CURRENT_USER, strRegKey) == ERROR_SUCCESS )
	{
		DWORD dwIndex = 0;
		BOOL bStop = false;
		do
		{
			DWORD dwValueType = 0, cbName = _MAX_PATH;
			TCHAR lpName[_MAX_PATH];    lpName[0] = 0;
			LONG lVal = RegEnumValue(keyRecentConverterIDs,dwIndex++,lpName,&cbName,0,&dwValueType,0,0);
			if( (lVal == ERROR_SUCCESS) || (lVal == ERROR_MORE_DATA) )
			{
				// skip the default value
				if( _tcslen(lpName) > 0 )
				{
					TRACE(_T("Found: (%s)"), lpName);
					if( cbRecentlyUsed.FindStringExact(0,lpName) < 0 )
						cbRecentlyUsed.AddString(lpName);
				}
			}
			else
				bStop = true;
		} while( !bStop );

		// select the first one so there's something in it.
		cbRecentlyUsed.SetCurSel(0);
	}
}
void CNetworkControllView::initTimeServerList()
{

	m_szServers.clear();
	CComboBox* pCbx = (CComboBox*)GetDlgItem(IDC_COMBO_TIMESERVERLIST);
	pCbx->ResetContent();
	pCbx->Clear();
	for (int i = 0 ; i < 5; i++)
	{
		m_szServers.push_back(c_strTimeserverList[i]);
	}

	CString strIndex;
	CString strValue;
	for (int i = 6; i <= 10; i++)
	{
		strIndex.Format(_T("server%d"), i);
		if(LoadTimeServerFromRegister(strIndex, strValue))
		{
			m_szServers.push_back(strValue);
		}
		else
		{
			break;
		}
	}

	for (UINT n = 0; n < m_szServers.size(); n++)
	{
		pCbx->AddString(m_szServers[n]);
	}

	pCbx->SetCurSel(0);
}
예제 #4
0
void CComboBox_Assign(CComboBox &ctrlComboBox, const CStringArray &arrstrItems)
{
    ASSERT(ctrlComboBox.GetSafeHwnd() != NULL);

    ctrlComboBox.Clear();
    for (int i = 0; i < arrstrItems.GetCount(); ++i)
        ctrlComboBox.AddString(arrstrItems[i]);
}
예제 #5
0
파일: financedemoDlg.cpp 프로젝트: vopl/sp
//
// Helper utility to initialize a combo box from an array of text
//
static void initComboBox(CComboBox &b, const TCHAR *list[], int count, const TCHAR *initial)
{
    b.Clear();
    for (int i = 0; i < count; i += 2)
        //The odd index are the display text, the even index are the keys
        b.SetItemDataPtr(b.AddString(list[i + 1]), (void *)(list[i]));
    b.SelectString(0, initial);
}
예제 #6
0
파일: StdAfx.cpp 프로젝트: mk-z/Scan
void ClearComboBox(CComboBox &stComboBox)
{
	stComboBox.Clear();
	{
		int n = stComboBox.GetCount();
		for (int i=0; i<n; i++)
		{
			stComboBox.DeleteString(0);
		}
	}
}