Changeset 355 for trunk/dll/printer.c
- Timestamp:
- Jul 26, 2006, 9:58:11 PM (19 years ago)
- File:
-
- 1 edited
-
trunk/dll/printer.c (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/printer.c
r123 r355 4 4 $Id$ 5 5 6 Print file list 7 6 8 Copyright (c) 1993-98 M. Kimes 7 Copyright (c) 2004 Steven H.Levine 8 9 Revisions 01 Aug 04 SHL - Rework lstrip/rstrip usage 9 Copyright (c) 2004, 2006 Steven H.Levine 10 11 01 Aug 04 SHL Rework lstrip/rstrip usage 12 17 Jul 06 SHL Use Runtime_Error 10 13 11 14 ***********************************************************************/ … … 27 30 28 31 #pragma data_seg(DATA1) 32 33 static PSZ pszSrcFile = __FILE__; 34 29 35 #pragma alloc_text(PRINTER,PrinterReady,SayPrinterReady) 30 36 #pragma alloc_text(PRINTER2,PrintList) … … 34 40 35 41 36 BOOL PrinterReady (CHAR *printdevname) {37 42 BOOL PrinterReady (CHAR *printdevname) 43 { 38 44 FILE * printhandle; 39 45 CHAR param = 0, … … 46 52 return TRUE; 47 53 DosError(FERR_DISABLEHARDERR); 48 printhandle = fopen(printdevname,"a+");49 if (printhandle) {54 printhandle = xfopen(printdevname,"a+",pszSrcFile,__LINE__); 55 if (printhandle) { 50 56 if(!strnicmp(printdevname,"COM",3) && isdigit(printdevname[3])) { 51 57 fclose(printhandle); … … 71 77 72 78 73 BOOL SayPrinterReady (HWND hwnd) {74 79 BOOL SayPrinterReady (HWND hwnd) 80 { 75 81 if(!hwnd) 76 82 hwnd = HWND_DESKTOP; … … 86 92 87 93 88 VOID PrintList (VOID *arg) { /* background-print a list of files */ 89 94 //=== PrintList - background-print a list of files === 95 96 VOID PrintList (VOID *arg) 97 { 90 98 HAB hab2; 91 99 HMQ hmq2; … … 104 112 if(!PrintSem) { 105 113 if(DosCreateMutexSem(NULL,&PrintSem,0,FALSE)) { 106 Dos Beep(250,100);114 Dos_Error(MB_CANCEL,rc,HWND_DESKTOP,pszSrcFile,__LINE__,"DosCreateMutexSem"); 107 115 goto Abort; 108 116 } … … 130 138 if(StopPrinting) 131 139 break; 132 if(PrinterReady(li->targetpath)) { 140 if (!PrinterReady(li->targetpath)) 141 Runtime_Error(pszSrcFile, __LINE__, "printer %s error", li->targetpath); 142 else { 133 143 fpi = _fsopen(li->list[x],"r",SH_DENYWR); 134 if(fpi) { 144 if (!fpi) 145 Runtime_Error(pszSrcFile, __LINE__, "cannot open %s",li->list[x]); 146 else { 135 147 fpo = _fsopen(li->targetpath,"a+",SH_DENYRW); 136 if(fpo) { 148 if(!fpo) 149 Runtime_Error(pszSrcFile, __LINE__, "cannot open %s",li->targetpath); 150 else { 137 151 sprintf(s, 138 152 GetPString(IDS_PRINTINGTEXT), … … 298 312 fclose(fpo); 299 313 } 300 else301 DosBeep(50,100);302 314 fclose(fpi); 303 315 } 304 else305 DosBeep(50,100);306 }307 else {308 DosBeep(50,100);309 DosBeep(250,100);310 316 } 311 317 DosReleaseMutexSem(PrintSem); … … 327 333 328 334 329 MRESULT EXPENTRY PrintDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) {330 335 MRESULT EXPENTRY PrintDlgProc (HWND hwnd,ULONG msg,MPARAM mp1,MPARAM mp2) 336 { 331 337 LISTINFO *li; 332 338 … … 388 394 WinSetDlgItemText(hwnd,PRN_PRINTER,printer); 389 395 WinSendDlgItemMsg(hwnd,PRN_LISTBOX,LM_DELETEALL,MPVOID,MPVOID); 390 li = WinQueryWindowPtr(hwnd,0); 391 if(li) { 392 396 li = WinQueryWindowPtr(hwnd,QWL_USER); 397 if (!li) 398 Runtime_Error(pszSrcFile, __LINE__, "no data"); 399 else { 393 400 INT x; 394 401 … … 438 445 switch(SHORT1FROMMP(mp1)) { 439 446 case DID_OK: 440 li = WinQueryWindowPtr(hwnd,0); 441 if(li) { 447 li = WinQueryWindowPtr(hwnd,QWL_USER); 448 if (!li) 449 Runtime_Error(pszSrcFile, __LINE__, "no data"); 450 else { 442 451 prnformat = WinQueryButtonCheckstate(hwnd,PRN_FORMAT); 443 452 PrfWriteProfileData(fmprof,FM3Str,"Prnformat", … … 576 585 error = AddToList(szBuffer,&li->list,&numfiles,&numalloc); 577 586 if(error) { 578 DosBeep(250,100);587 Runtime_Error(pszSrcFile, __LINE__, "AddToList"); 579 588 break; 580 589 }
Note:
See TracChangeset
for help on using the changeset viewer.
