#include <windows.h>#include <commdlg.h> #pragma comment(lib, "comdlg32.lib") int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) { CHOOSEFONT cf; LOGFONT lf; ZeroMemory(&cf, sizeof(cf)); ZeroMemory(&lf, sizeof(lf)); cf.lStructSize = sizeof(cf); cf.hwndOwner = NULL; // Storage for selected font cf.lpLogFont = &lf; // Options cf.Flags = CF_SCREENFONTS | CF_EFFECTS | CF_INITTOLOGFONTSTRUCT; // Show font dialog if (ChooseFont(&cf)) { TCHAR buffer[256]; wsprintf( buffer, TEXT("Font selected:\n\n%s\nSize: %d"), lf.lfFaceName, cf.iPointSize / 10 ); MessageBox( NULL, buffer, TEXT("Font Selection"), MB_OK | MB_ICONINFORMATION ); } return 0; }