当前位置: 首页>>代码示例>>C++>>正文


C++ CComboBox::GetSafeHwnd方法代码示例

本文整理汇总了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);
}
开发者ID:myd7349,项目名称:Ongoing-Study,代码行数:9,代码来源:MFCExtensions.cpp

示例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]);
}
开发者ID:myd7349,项目名称:Ongoing-Study,代码行数:8,代码来源:MFCExtensions.cpp

示例3: UpdateData

void CAntiVirus::UpdateData(CComboBox& wndAntiVirus)
{
	if ( ! ::IsWindow( wndAntiVirus.GetSafeHwnd() ) )
		return;

	if ( wndAntiVirus.IsWindowEnabled() )
	{
		Settings.General.AntiVirus = *(CString*)wndAntiVirus.GetItemDataPtr( wndAntiVirus.GetCurSel() );
	}
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:10,代码来源:AntiVirus.cpp

示例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 );
	}
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:11,代码来源:AntiVirus.cpp

示例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;
}
开发者ID:myd7349,项目名称:Ongoing-Study,代码行数:12,代码来源:MFCExtensions.cpp

示例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 );
}
开发者ID:ivan386,项目名称:Shareaza,代码行数:49,代码来源:AntiVirus.cpp

示例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;
    }
}
开发者ID:myd7349,项目名称:Ongoing-Study,代码行数:15,代码来源:MFCExtensions.cpp

示例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;
}
开发者ID:lai3d,项目名称:ThisIsASoftRenderer,代码行数:64,代码来源:XTPSyntaxEditPropertiesPage.cpp


注:本文中的CComboBox::GetSafeHwnd方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。