- Timestamp:
- Dec 30, 2002, 8:04:54 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/comdlg32/printdlg.c
r9364 r9570 134 134 #define MAX_COPIES 9999 135 135 136 137 #ifdef __WIN32OS2__ 138 /*********************************************************************** 139 * PrnNameToQueue 140 * 141 * Odin helper function that gets Queue Name from Printer Name 142 * 143 * Returns TRUE on success else FALSE 144 */ 145 146 BOOL PrnNameToQueue(char* PrnName, char* QueueName) 147 { 148 BOOL rc = FALSE; 149 150 if (PrnName && QueueName) 151 { 152 LPPRINTER_INFO_2A pi; 153 DWORD needed, num; 154 INT i; 155 156 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num); 157 pi = HeapAlloc(GetProcessHeap(), 0, needed); 158 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, (LPBYTE)pi, needed, &needed, 159 &num); 160 161 for(i = 0; i < num; i++) 162 if (!strcmp(pi[i].pComment, PrnName)) 163 { 164 strcpy(QueueName, pi[i].pPrinterName); 165 rc = TRUE; 166 } 167 HeapFree(GetProcessHeap(), 0, pi); 168 } 169 return rc; 170 } 171 #endif 172 136 173 /*********************************************************************** 137 174 * PRINTDLG_GetDefaultPrinterName … … 218 255 INT i; 219 256 LPPRINTER_INFO_2A pi; 257 #ifdef __WIN32OS2__ 258 char substName[260]; 259 #endif 260 220 261 EnumPrintersA(PRINTER_ENUM_LOCAL, NULL, 2, NULL, 0, &needed, &num); 221 262 pi = HeapAlloc(GetProcessHeap(), 0, needed); … … 223 264 &num); 224 265 266 #ifndef __WIN32OS2__ 225 267 for(i = 0; i < num; i++) { 226 268 SendDlgItemMessageA(hDlg, id, CB_ADDSTRING, 0, … … 228 270 } 229 271 HeapFree(GetProcessHeap(), 0, pi); 272 #else 273 substName[0] = 0; 274 275 for(i = 0; i < num; i++) 276 { 277 SendDlgItemMessageA(hDlg, id, CB_ADDSTRING, 0, 278 (LPARAM)pi[i].pComment ); 279 if (!name || !strcmp(pi[i].pPrinterName, name)) 280 strcpy(substName, pi[i].pComment); 281 } 282 #endif 283 230 284 if(!name || 231 285 (i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, 286 #ifndef __WIN32OS2__ 232 287 (LPARAM)name)) == CB_ERR) { 233 288 #else 289 (LPARAM)substName)) == CB_ERR) { 290 #endif 234 291 char buf[260]; 235 292 FIXME("Can't find '%s' in printer list so trying to find default\n", … … 237 294 if(!PRINTDLG_GetDefaultPrinterNameA(buf, sizeof(buf))) 238 295 return num; 296 #ifndef __WIN32OS2__ 239 297 i = SendDlgItemMessageA(hDlg, id, CB_FINDSTRINGEXACT, -1, (LPARAM)buf); 298 #else 299 for(i = 0; i < num; i++) 300 if (!strcmp(pi[i].pComment, buf)) 301 break; 302 HeapFree(GetProcessHeap(), 0, pi); 303 #endif 304 240 305 if(i == CB_ERR) 241 306 FIXME("Can't find default printer in printer list\n"); … … 1035 1100 return FALSE; 1036 1101 } 1102 #ifndef __WIN32OS2__ 1037 1103 ClosePrinter(hprn); 1104 #endif 1038 1105 1039 1106 PRINTDLG_UpdatePrinterInfoTextsA(hDlg, PrintStructures->lpPrinterInfo); … … 1044 1111 } 1045 1112 1113 #ifdef __WIN32OS2__ 1114 dmSize = DocumentPropertiesA(0, hprn, name, NULL, NULL, 0); 1115 #else 1046 1116 dmSize = DocumentPropertiesA(0, 0, name, NULL, NULL, 0); 1117 #endif 1047 1118 if(dmSize == -1) { 1048 1119 ERR("DocumentProperties fails on %s\n", debugstr_a(name)); … … 1050 1121 } 1051 1122 PrintStructures->lpDevMode = HeapAlloc(GetProcessHeap(), 0, dmSize); 1123 1124 #ifdef __WIN32OS2__ 1125 dmSize = DocumentPropertiesA(0, hprn, name, PrintStructures->lpDevMode, NULL, 1126 #else 1052 1127 dmSize = DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, NULL, 1128 #endif 1053 1129 DM_OUT_BUFFER); 1130 1054 1131 if(lppd->hDevMode && (lpdm = GlobalLock(lppd->hDevMode)) && 1055 1132 !strcmp(lpdm->dmDeviceName, 1056 1133 PrintStructures->lpDevMode->dmDeviceName)) { 1057 1134 /* Supplied devicemode matches current printer so try to use it */ 1135 #ifdef __WIN32OS2__ 1136 DocumentPropertiesA(0, hprn, name, PrintStructures->lpDevMode, lpdm, 1137 #else 1058 1138 DocumentPropertiesA(0, 0, name, PrintStructures->lpDevMode, lpdm, 1139 #endif 1059 1140 DM_OUT_BUFFER | DM_IN_BUFFER); 1060 1141 } 1142 #ifdef __WIN32OS2__ 1143 ClosePrinter(hprn); 1144 #endif 1061 1145 if(lpdm) 1062 1146 GlobalUnlock(lppd->hDevMode); … … 1423 1507 name = HeapAlloc(GetProcessHeap(),0,256); 1424 1508 if (GetDlgItemTextA(hDlg, comboID, name, 255)) 1509 #ifdef __WIN32OS2__ 1510 PrnNameToQueue(name, name); 1511 #endif 1425 1512 PRINTDLG_ChangePrinterA(hDlg, name, PrintStructures); 1426 1513 HeapFree(GetProcessHeap(),0,name); … … 1429 1516 char name[200]; 1430 1517 BOOL ret = PRINTDLG_GetDefaultPrinterNameA(name, sizeof(name)); 1431 1518 #ifdef __WIN32OS2__ 1519 PrnNameToQueue(name, name); 1520 #endif 1432 1521 if (ret) 1433 1522 PRINTDLG_ChangePrinterA(hDlg, name, PrintStructures); … … 1745 1834 1746 1835 GetDlgItemTextA(hDlg, PrinterComboID, PrinterName, 255); 1836 #ifdef __WIN32OS2__ 1837 PrnNameToQueue(PrinterName, PrinterName); 1838 #endif 1747 1839 if (!OpenPrinterA(PrinterName, &hPrinter, NULL)) { 1748 1840 FIXME(" Call to OpenPrinter did not succeed!\n"); … … 1785 1877 char PrinterName[256]; 1786 1878 GetDlgItemTextA(hDlg, LOWORD(wParam), PrinterName, 255); 1879 #ifdef __WIN32OS2__ 1880 PrnNameToQueue(PrinterName, PrinterName); 1881 #endif 1787 1882 PRINTDLG_ChangePrinterA(hDlg, PrinterName, PrintStructures); 1788 1883 } … … 3581 3676 return E_NOTIMPL; 3582 3677 } 3678
Note:
See TracChangeset
for help on using the changeset viewer.