本文整理汇总了C++中CComboBox::Invalidate方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::Invalidate方法的具体用法?C++ CComboBox::Invalidate怎么用?C++ CComboBox::Invalidate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::Invalidate方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: FillCountryComboBox
extern "C" BOOL FAR PASCAL _export FillCountryComboBox(HWND hComboBox, WORD wSelectCountryId /*=0*/)
#endif
{
BOOL fResult = FALSE;
// Fill the specified combo box with the country names from the resource file.
// The data for each item is set to the country ID number.
CComboBox ComboBox;
CString csCountry;
TRY
{
ComboBox.Attach(hComboBox);
ComboBox.SetRedraw(FALSE);
if (wSelectCountryId == 0)
{
wSelectCountryId = ID_UnitedStatesOfAmerica;
}
int nSelectIndex = 0;
int nCount = CCountryTableEntry::GetCountryTableEntryCount();
for (int nCountry = 0; nCountry < nCount; nCountry++)
{
CCountryTableEntry* pCountry = CCountryTableEntry::GetCountryEntryByIndex(nCountry);
if (pCountry != NULL)
{
csCountry.LoadString(pCountry->GetId());
int nComboIndex = ComboBox.AddString(csCountry);
if (nComboIndex != CB_ERR)
{
ComboBox.SetItemData(nComboIndex, (DWORD)(pCountry->GetId()));
if (pCountry->GetId() == wSelectCountryId)
{
nSelectIndex = nComboIndex;
}
}
}
}
if (nSelectIndex != 0)
{
ComboBox.SetCurSel(nSelectIndex);
}
ComboBox.SetRedraw(TRUE);
ComboBox.Invalidate();
ComboBox.Detach();
fResult = TRUE;
}
CATCH_ALL(e)
{
if (ComboBox.m_hWnd != NULL)
{
ComboBox.SetRedraw(TRUE);
ComboBox.Detach();
}
fResult = FALSE;
}
END_CATCH_ALL
return fResult;
}