home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!wupost!waikato.ac.nz!canterbury.ac.nz!cantua!misc042
- Newsgroups: comp.sys.mac.programmer
- Subject: Think P & Printtraps.p
- Message-ID: <C0IEM1.GLy@cantua.canterbury.ac.nz>
- From: misc042@cantua.canterbury.ac.nz (Mr M J Miller)
- Date: Fri, 8 Jan 1993 00:27:36 GMT
- Organization: University of Canterbury, Christchurch, New Zealand.
- Nntp-Posting-Host: cantua.canterbury.ac.nz
- X-Newsreader: TIN [version 1.1 PL8]
- Lines: 83
-
-
- Hi,
- This pice of printing code works fine in a compiled application,
- but why does Think Pascal 4.01 intermittenly barf with error message
- something like "Launch and Chain not allowed" ?
-
- Is it me or is it Think Pascal?
- The error is near the first close.
-
- procedure document.mprint;
- var
- hPrtRec: THPrint; { Printer info record handle }
- pPrPort: TPPrPort; { Printer graphport etc }
- iErr: osErr; { error codes }
- begin
- PrOpen;
- iErr := PrError;
-
- if (iErr <> noErr) then
-
- else { PrOpen OK! }
- begin
- hPrtRec := THPrint(NewHandle(sizeOf(TPrint)));
- if (hPrtRec = nil) then
-
- else { newHandle OK ! }
- begin
- PrintDefault(hPrtRec);
- iErr := PrError;
-
- if (iErr <> noErr) then
-
- else { PrintDefault OK! }
- begin
- if (PrStlDialog(hPrtRec)) & (PrJobDialog(hPrtRec)) then
- begin { dialogues OK! }
- pPrPort := PrOpenDoc(hPrtRec, nil, nil);
- iErr := PrError;
-
- if (iErr <> noErr) then
-
- else { PrOpenDoc OK! }
- begin
- PrOpenPage(pPrPort, nil);
- iErr := PrError;
-
- if (iErr <> noErr) then
- eNotify('at PrOpenPage', 'Aborting Print', iErr)
-
- else { PrOpenPage OK! }
- drawPrinter;
- end; { PrOpenDoc OK! }
-
- PrClosePage(pPrPort);
- iErr := PrError;
-
- if (iErr <> noErr) then
- end; { dialogues OK! }
-
- PrCloseDoc(pPrPort);
- iErr := PrError;
-
- if (iErr <> noErr) then
- end; { PrintDefault OK! }
-
- DisposHandle(handle(hPrtRec));
- end; { newHandle OK! }
- end; { PrOpen OK! }
-
- PrClose;
- iErr := PrError;
-
- if (iErr <> noErr) then
- eNotify('during print loop or at driver close', '', iErr)
- end;
-
- Any help would be appreciated.
-
- misc042@cantua.canterbury.ac.nz OR
- m.miller@csc.canterbury.ac.nz
- (I am no way employed by,
- or a spokesperson of,
- the University of Canterbury)
-