Microsoft KB Archive/47971

= How to Read &quot;LPT1: PROMPT&quot; Dialog Record, Macintosh QuickBASIC =

Article ID: 47971

Article Last Modified on 11/21/2006



This article was previously published under Q47971



SUMMARY
When you open the printer device from your QuickBASIC program with OPEN &quot;LPT1:PROMPT&quot; FOR OUTPUT AS #n, two dialog boxes appear that allow you to set printer options at run time.

The sample program below shows how to read the &quot;LPT1:PROMPT&quot; options selected in the dialog boxes.

This information applies to Microsoft QuickBASIC Version 1.00 for the Apple Macintosh.



MORE INFORMATION
Page II-147 of &quot;Inside Macintosh, Volume II&quot; (published by Addison-Wesley, 1985) describes the Print Manager and shows the record structure for the Print Record and Dialogs. Your application should not change the data in the Print Record. Attempting to set other values directly in the Print Record can produce unexpected results.

Code Example
OPEN &quot;lpt1:prompt&quot; FOR OUTPUT AS #1 CALL GetPrintRecord CALL ShowPrintRecord CLOSE WHILE MOUSE(0)<> 1 :WEND END

SUB GetPrintRecord STATIC SHARED hPrint&, fLaser, iVRes, iHRes, iFstPage, iLstPage, iCopies IF SYSTEM(4) = 0 THEN IF SYSTEM(2) <> 4 THEN PRINT &quot;Must use Microsoft QuickBASIC Version 1.00&quot; BEEP : STOP END IF      PrintHandle& = -6180 GloblPtr& = PEEKL(&H904) ELSE DIM GlobalCode%(4) GlobalCode%(0) = &H226F            'MOVEA.L 4(A7),A1 GlobalCode%(1) = &H4 GlobalCode%(2) = &H2288            'MOVE.L A0,(A1) GlobalCode%(3) = &h4E75            'RTS GetGlobal& = VARPTR(GlobalCode%(0)) CALL GetGlobal&(VARPTR(GloblPtr&))  'Get base of global storage PrintHandle& = 3626                 'Offset to printer variable ERASE GlobalCode% END IF

hPrint& = PEEKL(GloblPtr&+PrintHandle&) IF hPrint& <> 0 THEN pPrint& = PEEKL(hPrint&) iPrVersion = PEEKW(pPrint&) iDev = PEEKW(pPrint& + 2) iVRes = PEEKW(pPrint& + 4) iHRes = PEEKW(pPrint& + 6) rPageTop = PEEKW(pPrint& +  8) rPageLeft = PEEKW(pPrint& + 10) rPageBottom = PEEKW(pPrint& + 12) rPageRight = PEEKW(pPrint& + 14) rPaperTop = PEEKW(pPrint& + 16) rPaperLeft = PEEKW(pPrint& + 18) rPaperBottom = PEEKW(pPrint& + 20) rPaperRight = PEEKW(pPrint& + 22) wDev = PEEKW(pPrint& + 24) fLaser = 0 IF (wDev AND &HF00) = &H300 THEN fLaser = -1 prJob& = pPrint& + 62 iFstPage = PEEKW(prJob&) iLstPage = PEEKW(prJob& + 2) IF fLaser THEN iCopies = PEEKW(pPrint& + 46) ELSE iCopies = PEEKW(pPrint&+ 66) END IF   END IF END SUB

SUB ShowPrintRecord STATIC SHARED hPrint&, fLaser, iVRes, iHRes, iFstPage, iLstPage, iCopies IF hPrint& <> 0 THEN PRINT &quot;Print Manager Version = &quot;;iPrVersion PRINT &quot;Printer is &quot;; IF fLaser THEN PRINT &quot;a LaserWriter&quot; ELSE PRINT &quot;an ImageWriter&quot; END IF       PRINT &quot;Vertical resolution = &quot;;iVRes PRINT &quot;Horizontal resolution = &quot;;iHRes PRINT &quot;First page = &quot;; iFstPage PRINT &quot;Last page = &quot;; iLstPage PRINT &quot;# Copies = &quot;;iCopies ELSE PRINT &quot;No Print Record allocated&quot; END IF END SUB

Additional query words: MQuickB

Keywords: KB47971

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.