Font in Combo
-
1. Enumerating the Installed Fonts[^] 2. CComboBox::AddString()[^]
It is a crappy thing, but it's life -^ Carlo Pallini
-
1. Enumerating the Installed Fonts[^] 2. CComboBox::AddString()[^]
It is a crappy thing, but it's life -^ Carlo Pallini
-
if possible please let me know how can i use in MFC dialog based project ..as im anew bie..
MFC does not have any special functions for this purpose. You can use this, I suppose:
int CALLBACK EnumFontFamExProc(
ENUMLOGFONTEX *lpelfe,
NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam
)
{
OutputDebugString(lpelfe->elfFullName); //Populate your combo box here
return true;
}CTestDlg::OnOK()
{
LOGFONT logFont;
logFont.lfCharSet = 0;
_tcscpy(logFont.lfFaceName, _T("\0"));
logFont.lfPitchAndFamily = 0;
EnumFontFamiliesEx(*GetDC(), &logFont, (FONTENUMPROC)EnumFontFamExProc, 0, 0);
}Watch your debugger output window to see the results printed into it from the callback function.
It is a crappy thing, but it's life -^ Carlo Pallini
-
MFC does not have any special functions for this purpose. You can use this, I suppose:
int CALLBACK EnumFontFamExProc(
ENUMLOGFONTEX *lpelfe,
NEWTEXTMETRICEX *lpntme,
DWORD FontType,
LPARAM lParam
)
{
OutputDebugString(lpelfe->elfFullName); //Populate your combo box here
return true;
}CTestDlg::OnOK()
{
LOGFONT logFont;
logFont.lfCharSet = 0;
_tcscpy(logFont.lfFaceName, _T("\0"));
logFont.lfPitchAndFamily = 0;
EnumFontFamiliesEx(*GetDC(), &logFont, (FONTENUMPROC)EnumFontFamExProc, 0, 0);
}Watch your debugger output window to see the results printed into it from the callback function.
It is a crappy thing, but it's life -^ Carlo Pallini
Oh great, now he's gonna ask how to take the output from the debugger window and add it to a combobox. :doh:
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
-
Oh great, now he's gonna ask how to take the output from the debugger window and add it to a combobox. :doh:
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
:laugh: Stop giving him hints, won't you?
It is a crappy thing, but it's life -^ Carlo Pallini