Hi All ! ,
I have an error when trying to get all the fonts from the system into A list Tool.
Before i start i must say I dont have a lot of experience in Visual C++ , Im transferring from C++ & C to Visual right now.
What im trying to do is to get the entire Windows fonts list to a List tool on my DLG.
here is the code for that :
int CALLBACK MyEnumFontProc(ENUMLOGFONTEX* lpelf, NEWTEXTMETRICEX lpntm, DWORD nFontType , long lParam)
{
<span style="white-space
re CSolarBox01Dlg* pWnd = (CSolarBox01Dlg*)lParam;
<span style="white-space
re if (pWnd)
<span style="white-space
re {
<span style="white-space
re pWnd->m_ctlFontList.AddString(lpelf->elfLogFont.lfFaceName);
<span style="white-space
re TRACE("GOOD");
<span style="white-space
re return 1;
<span style="white-space
re }
<span style="white-space
re return 0;
}
void CSolarBox01Dlg::FillFontList(void)
{
<span style="white-space
re LOGFONT lf;
<span style="white-space
re lf.lfCharSet = DEFAULT_CHARSET;
<span style="white-space
re lf.lfFaceName[0] = NULL;
<span style="white-space
re lf.lfPitchAndFamily = 0;
<span style="white-space
re m_ctlFontList.ResetContent();
<span style="white-space
re
<span style="white-space
re m_ctlFontList.AddString(L"Test String");
<span style="white-space
re CClientDC dc(this);
<span style="white-space
re ::EnumFontFamiliesEx( (HDC) dc , &lf , (FONTENUMPROC)MyEnumFontProc
<span style="white-space
re , (LPARAM)this , 0);
}
The error i get :
<br/>
Unhandled exception at 0x54281f9c (mfc100ud.dll) in SolarBox 0.1.exe: 0xC0000005: Access violation reading location 0x60cb573e.
<br/>
when i press break it stops on that line :
<br/>
_AFXWIN_INLINE int CListBox::AddString(LPCTSTR lpszItem)
when <span style="white-space
re { ASSERT
:IsWindow(m_hWnd)); return (int)::SendMessage(m_hWnd, LB_ADDSTRING, 0, (LPARAM)lpszItem); }
<br/>
output window for this run :
<br/>
Warning: initial dialog data is out of range.
First-chance exception at 0x54281f9c (mfc100ud.dll) in SolarBox 0.1.exe: 0xC0000005: Access violation reading location 0x60cb573e.
Unhandled exception at 0x54281f9c (mfc100ud.dll) in SolarBox 0.1.exe: 0xC0000005: Access violation reading location 0x60cb573e.
<br/>
<br/>
<br/>
View the full article
I have an error when trying to get all the fonts from the system into A list Tool.
Before i start i must say I dont have a lot of experience in Visual C++ , Im transferring from C++ & C to Visual right now.
What im trying to do is to get the entire Windows fonts list to a List tool on my DLG.
here is the code for that :
int CALLBACK MyEnumFontProc(ENUMLOGFONTEX* lpelf, NEWTEXTMETRICEX lpntm, DWORD nFontType , long lParam)
{
<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

}
void CSolarBox01Dlg::FillFontList(void)
{
<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

<span style="white-space

}
The error i get :
<br/>
Unhandled exception at 0x54281f9c (mfc100ud.dll) in SolarBox 0.1.exe: 0xC0000005: Access violation reading location 0x60cb573e.
<br/>
when i press break it stops on that line :
<br/>
_AFXWIN_INLINE int CListBox::AddString(LPCTSTR lpszItem)
when <span style="white-space


<br/>
output window for this run :
<br/>
Warning: initial dialog data is out of range.
First-chance exception at 0x54281f9c (mfc100ud.dll) in SolarBox 0.1.exe: 0xC0000005: Access violation reading location 0x60cb573e.
Unhandled exception at 0x54281f9c (mfc100ud.dll) in SolarBox 0.1.exe: 0xC0000005: Access violation reading location 0x60cb573e.
<br/>
<br/>
<br/>
View the full article