다음과 같이 해보세요
//---------------------------------------------------------------------------
int CALLBACK EnumFontsProc(LOGFONT *lplf, TEXTMETRIC *lptm, DWORD dwType,LPARAM lpData)
{
//LPARAM을 이용하여..
TMemo *Memo=(TMemo *)lpData;
if(Memo)Memo->Lines->Add(lplf->lfFaceName);
return 1; //return값이 0 이면 더이상 callback이 발생하지 않음
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Memo1->Lines->Clear();
//LParam으로 Memo1객체를 넘깁니다.
EnumFontFamilies(GetDC(0), NULL, (FONTENUMPROC)EnumFontsProc, (int)Memo1);
}
//---------------------------------------------------------------------------
그럼..
공부중 님이 쓰신 글 :
: int CALLBACK EnumFontsProc(LOGFONT *lplf, TEXTMETRIC *lptm, DWORD dwType,LPARAM lpData)
: {
: Form2->Memo1->Lines->Add(lplf->lfFaceName);
: }
:
: void __fastcall TForm2::Button4Click(TObject *Sender)
: {
: Memo1->Lines->Clear();
: EnumFontFamilies(GetDC(0),NULL,(FONTENUMPROC)EnumFontsProc, NULL);
:
: }
: 윈도우 폰트에는 여러 가지폰트가 있습니다 .
: 왜 이런지 이해가 안갑니다.
|