From e17745ee737f6ba6ad75fe1e3b13ca5641436b09 Mon Sep 17 00:00:00 2001 From: Eric Kohl Date: Thu, 16 Mar 2017 23:36:08 +0000 Subject: [PATCH] [FONTVIEW] Implement fontview /p parameter support. Patch by amber. Patch was slightly modified by me in order to open the print dialog automatically. CORE-12944 #resolve #comment Thanks a lot! svn path=/trunk/; revision=74183 --- reactos/base/applications/fontview/fontview.c | 23 ++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/reactos/base/applications/fontview/fontview.c b/reactos/base/applications/fontview/fontview.c index 654f6a9c720..fe0bf8aa304 100644 --- a/reactos/base/applications/fontview/fontview.c +++ b/reactos/base/applications/fontview/fontview.c @@ -37,6 +37,7 @@ INT g_NumFonts = 0; LOGFONTW g_LogFonts[64]; LPCWSTR g_fileName; WCHAR g_FontTitle[1024] = L""; +BOOL g_FontPrint = FALSE; static const WCHAR g_szFontViewClassName[] = L"FontViewWClass"; @@ -156,7 +157,24 @@ wWinMain(HINSTANCE hThisInstance, else { /* Try to add the font resource from command line */ - fileName = argv[1]; +// fileName = argv[1]; + if (argc == 2) + { + fileName = argv[1]; + } + else + { + /* Windows fontview supports the /p option, which displays print dialog */ + fileName = argv[2]; + if (wcscmp(argv[1], L"/p") == 0) + { + g_FontPrint = TRUE; + } + else + { + fileName = argv[1]; + } + } g_fileName = fileName; } @@ -361,6 +379,9 @@ MainWnd_OnCreate(HWND hwnd) SendMessage(hDisplay, FVM_SETTYPEFACE, 0, (LPARAM)&g_LogFonts[g_FontIndex]); ShowWindow(hDisplay, SW_SHOWNORMAL); + if (g_FontPrint) + PostMessage(hwnd, WM_COMMAND, IDC_PRINT, 0); + return 0; }