From: Brendan McGrath bmcgrath@codeweavers.com
This will display the name of the selected printer on the Print dialog and the default printer on the Print Setup dialog --- dlls/comdlg32/printdlg.c | 32 ++++++++++++++++++++++++++++---- 1 file changed, 28 insertions(+), 4 deletions(-)
diff --git a/dlls/comdlg32/printdlg.c b/dlls/comdlg32/printdlg.c index e1a4da3c341..ffb86daf50a 100644 --- a/dlls/comdlg32/printdlg.c +++ b/dlls/comdlg32/printdlg.c @@ -978,10 +978,11 @@ static BOOL PRINTDLG_SetUpPaperComboBoxW(HWND hDlg, /*********************************************************************** * PRINTDLG_UpdatePrinterInfoTexts [internal] */ -static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *pi) +static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, DWORD flags, const PRINTER_INFO_2A *pi) { char StatusMsg[256]; char ResourceString[256]; + char PrinterName[256]; int i;
/* Status Message */ @@ -1004,6 +1005,17 @@ static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *p SetDlgItemTextA(hDlg, stc12, StatusMsg);
/* set all other printer info texts */ + if (flags & PD_PRINTSETUP) + { + DWORD dwBufLen = ARRAY_SIZE(PrinterName); + GetDefaultPrinterA(PrinterName, &dwBufLen); + } + else + { + /* FIXME: Windows decorates the printer name with text like 'System Printer' or 'on <port>'. */ + lstrcpynA(PrinterName, pi->pPrinterName, ARRAY_SIZE(PrinterName)); + } + SetDlgItemTextA(hDlg, stc1, PrinterName); SetDlgItemTextA(hDlg, stc11, pi->pDriverName);
if (pi->pLocation != NULL && pi->pLocation[0] != '\0') @@ -1014,10 +1026,11 @@ static void PRINTDLG_UpdatePrinterInfoTextsA(HWND hDlg, const PRINTER_INFO_2A *p return; }
-static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *pi) +static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, DWORD flags, const PRINTER_INFO_2W *pi) { WCHAR StatusMsg[256]; WCHAR ResourceString[256]; + WCHAR PrinterName[256]; int i;
/* Status Message */ @@ -1040,6 +1053,17 @@ static void PRINTDLG_UpdatePrinterInfoTextsW(HWND hDlg, const PRINTER_INFO_2W *p SetDlgItemTextW(hDlg, stc12, StatusMsg);
/* set all other printer info texts */ + if (flags & PD_PRINTSETUP) + { + DWORD dwBufLen = ARRAY_SIZE(PrinterName); + GetDefaultPrinterW(PrinterName, &dwBufLen); + } + else + { + /* FIXME: Windows decorates the printer name with text like 'System Printer' or 'on <port>'. */ + lstrcpynW(PrinterName, pi->pPrinterName, ARRAY_SIZE(PrinterName)); + } + SetDlgItemTextW(hDlg, stc1, PrinterName); SetDlgItemTextW(hDlg, stc11, pi->pDriverName); if (pi->pLocation != NULL && pi->pLocation[0] != '\0') SetDlgItemTextW(hDlg, stc14, pi->pLocation); @@ -1081,7 +1105,7 @@ static BOOL PRINTDLG_ChangePrinterA(HWND hDlg, char *name, PRINT_PTRA *PrintStru } ClosePrinter(hprn);
- PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo); + PRINTDLG_UpdatePrinterInfoTextsA(hDlg, lppd->Flags, PrintStructures->lpPrinterInfo);
free(PrintStructures->lpDevMode); PrintStructures->lpDevMode = NULL; @@ -1288,7 +1312,7 @@ static BOOL PRINTDLG_ChangePrinterW(HWND hDlg, WCHAR *name, } ClosePrinter(hprn);
- PRINTDLG_UpdatePrinterInfoTextsW(hDlg, PrintStructures->lpPrinterInfo); + PRINTDLG_UpdatePrinterInfoTextsW(hDlg, lppd->Flags, PrintStructures->lpPrinterInfo);
free(PrintStructures->lpDevMode); PrintStructures->lpDevMode = NULL;