本文整理汇总了C++中CComboBox::GetSafeHwnd方法的典型用法代码示例。如果您正苦于以下问题:C++ CComboBox::GetSafeHwnd方法的具体用法?C++ CComboBox::GetSafeHwnd怎么用?C++ CComboBox::GetSafeHwnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CComboBox
的用法示例。
在下文中一共展示了CComboBox::GetSafeHwnd方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
示例2: CComboBox_Assign
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]);
}
示例3: UpdateData
void CAntiVirus::UpdateData(CComboBox& wndAntiVirus)
{
if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
return;
if ( wndAntiVirus.IsWindowEnabled() )
{
Settings.General.AntiVirus = *(CString*)wndAntiVirus.GetItemDataPtr( wndAntiVirus.GetCurSel() );
}
}
示例4: Free
void CAntiVirus::Free(CComboBox& wndAntiVirus)
{
if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
return;
const int nCount = wndAntiVirus.GetCount();
for ( int i = 0; i < nCount; ++i )
{
delete (CString*)wndAntiVirus.GetItemDataPtr( i );
}
}
示例5: CComboBox_GetSelectedString
CString CComboBox_GetSelectedString(const CComboBox &ctrlComboBox)
{
ASSERT(ctrlComboBox.GetSafeHwnd() != NULL);
int nCurSel = ctrlComboBox.GetCurSel();
CString strSelectedItem;
if (nCurSel != CB_ERR)
ctrlComboBox.GetLBText(nCurSel, strSelectedItem);
return strSelectedItem;
}
示例6: Enum
void CAntiVirus::Enum(CComboBox& wndAntiVirus)
{
if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
return;
wndAntiVirus.ResetContent();
// No anti-virus
int nAntiVirus = wndAntiVirus.AddString( _T("") );
wndAntiVirus.SetItemDataPtr( nAntiVirus, (LPVOID)new CString() );
// Enum available anti-viruses
CComPtr< ICatInformation > pInfo;
HRESULT hr = pInfo.CoCreateInstance( CLSID_StdComponentCategoriesMgr );
if ( SUCCEEDED( hr ) )
{
const CATID IDs[ 1 ] = { CATID_MSOfficeAntiVirus };
CComPtr< IEnumCLSID > pEnum;
hr = pInfo->EnumClassesOfCategories( 1, IDs, 0, NULL, &pEnum );
if ( SUCCEEDED( hr ) )
{
CLSID clsid;
while ( pEnum->Next( 1, &clsid, NULL ) == S_OK )
{
const CString sCLSID = Hashes::toGuid( clsid, true );
HKEY hClass = NULL;
if ( ERROR_SUCCESS == RegOpenKeyEx( HKEY_CLASSES_ROOT, _T("CLSID\\") + sCLSID, 0, KEY_READ, &hClass ) )
{
// Get it name
TCHAR szValue[ MAX_PATH ] = {};
DWORD nValue = MAX_PATH, nType = REG_SZ;
if ( ERROR_SUCCESS == RegQueryValueEx( hClass, NULL, NULL, &nType, (LPBYTE)szValue, &nValue ) )
{
const int nIndex = wndAntiVirus.AddString( szValue );
wndAntiVirus.SetItemDataPtr( nIndex, (LPVOID)new CString( sCLSID ) );
if ( Settings.General.AntiVirus.CompareNoCase( sCLSID ) == 0 )
{
nAntiVirus = nIndex;
}
}
RegCloseKey( hClass );
}
}
}
}
wndAntiVirus.SetCurSel( nAntiVirus );
wndAntiVirus.EnableWindow( wndAntiVirus.GetCount() > 1 );
}
示例7: 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;
}
}
示例8: dc
AFX_STATIC int CALLBACK EnumFontFamExProc(
ENUMLOGFONTEX *lpelfe, // logical-font data
NEWTEXTMETRICEX *lpntme, // physical-font data
DWORD FontType, // type of font
LPARAM lParam) // application-defined data
{
CComboBox* pWndCombo = DYNAMIC_DOWNCAST(CComboBox, (CComboBox*)lParam);
if (::IsWindow(pWndCombo->GetSafeHwnd()))
{
switch (pWndCombo->GetDlgCtrlID())
{
case XTP_IDC_EDIT_COMB_NAMES:
{
//if (lpelfe->elfLogFont.lfPitchAndFamily & FIXED_PITCH)
{
// Make sure the fonts are only added once.
if (pWndCombo->FindStringExact(0, (LPCTSTR)lpelfe->elfFullName) == CB_ERR)
{
// Add to list
pWndCombo->AddString((LPCTSTR)lpelfe->elfLogFont.lfFaceName);
}
}
}
break;
case XTP_IDC_EDIT_COMB_SIZES:
{
if (FontType != TRUETYPE_FONTTYPE)
{
CWindowDC dc(NULL);
CString csSize;
csSize.Format(_T("%i"), ::MulDiv(lpntme->ntmTm.tmHeight - lpntme->ntmTm.tmInternalLeading,
72, ::GetDeviceCaps(dc.m_hDC, LOGPIXELSY)));
// Make sure the fonts are only added once.
if (pWndCombo->FindStringExact(0, (LPCTSTR)csSize) == CB_ERR)
{
// Add to list
pWndCombo->AddString((LPCTSTR)csSize);
}
}
}
break;
case XTP_IDC_EDIT_COMB_SCRIPT:
{
if (lpelfe->elfScript[0] != _T('\0'))
{
// Make sure the fonts are only added once.
if (pWndCombo->FindStringExact(0, (LPCTSTR)lpelfe->elfScript) == CB_ERR)
{
// Add to list
int iIndex = pWndCombo->AddString((LPCTSTR)lpelfe->elfScript);
if (iIndex != CB_ERR)
{
pWndCombo->SetItemData(iIndex,
(DWORD)lpelfe->elfLogFont.lfCharSet);
}
}
}
}
break;
}
}
return TRUE;
}