Index: base/applications/fontview/fontview.c =================================================================== --- base/applications/fontview/fontview.c (revision 54983) +++ base/applications/fontview/fontview.c (working copy) @@ -92,21 +92,46 @@ WNDCLASSEXW wincl; HINSTANCE hDLL; PGFRI GetFontResourceInfoW; + LPCWSTR fileName; g_hInstance = hThisInstance; - + /* Get unicode command line */ argv = CommandLineToArgvW(GetCommandLineW(), &argc); if (argc < 2) { - ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_BADCMD, argv[1]); - return -1; + OPENFILENAMEW fontOpen; + WCHAR szFileName[MAX_PATH] = L""; + + ZeroMemory(&fontOpen, sizeof(fontOpen)); + + fontOpen.lStructSize = sizeof(fontOpen); + fontOpen.hwndOwner = hMainWnd; + fontOpen.lpstrFilter = L"TrueType Font (*.ttf)\0*.ttf\0All Files (*.*)\0*.*\0"; + fontOpen.lpstrFile = szFileName; + fontOpen.lpstrTitle = L"Open Font..."; + fontOpen.nMaxFile = MAX_PATH; + fontOpen.Flags = OFN_EXPLORER | OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + fontOpen.lpstrDefExt = L"ttf"; + + /* Opens up the Open File dialog box in order to chose a font file. */ + if(GetOpenFileNameW(&fontOpen)) + { + fileName = fontOpen.lpstrFile; + } else { + /* If the user decides to close out of the open dialog */ + return 0; + } } - - /* Try to add the font resource */ - if (!AddFontResourceW(argv[1])) + else { - ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, argv[1]); + /* Try to add the font resource from command line */ + fileName = argv[1]; + } + + if (!AddFontResourceW(fileName)) + { + ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, fileName); return -1; } @@ -116,16 +141,16 @@ /* Get the font name */ dwSize = sizeof(g_ExtLogFontW.elfFullName); - if (!GetFontResourceInfoW(argv[1], &dwSize, g_ExtLogFontW.elfFullName, 1)) + if (!GetFontResourceInfoW(fileName, &dwSize, g_ExtLogFontW.elfFullName, 1)) { - ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, argv[1]); + ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, fileName); return -1; } dwSize = sizeof(LOGFONTW); - if (!GetFontResourceInfoW(argv[1], &dwSize, &g_ExtLogFontW.elfLogFont, 2)) + if (!GetFontResourceInfoW(fileName, &dwSize, &g_ExtLogFontW.elfLogFont, 2)) { - ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, argv[1]); + ErrorMsgBox(0, IDS_ERROR, IDS_ERROR_NOFONT, fileName); return -1; } Index: base/applications/fontview/fontview.rbuild =================================================================== --- base/applications/fontview/fontview.rbuild (revision 54983) +++ base/applications/fontview/fontview.rbuild (working copy) @@ -3,6 +3,7 @@ . gdi32 + comdlg32 user32 shell32 fontview.c