How To Direct Output to Installed GX PrintersLast reviewed: November 13, 1997Article ID: Q154064 |
3.00b MACINTOSH kbprg kbprint kb3rdparty kbhowto The information in this article applies to:
SUMMARYControlling what printer a program prints to can be accomplished through code with the enhancements to the SET PRINTER TO command in Visual FoxPro run with QuickDraw GX and some other new functions. This article provides a sample program combining the SYS(1038), the JustCSName() and the SET PRINTER TO NAME enhancements to illustrate how to control which printer a report is printed to. NOTE: QuickDraw GX is manufactured by a vendor independent of Microsoft; we make no warranty, implied or otherwise, regarding the performance or reliability of QuickDraw GX. QuickDraw GX is not supported in Macintosh OS 8 and this sample program will not work with Visual FoxPro running under OS 8.
MORE INFORMATION
Sample ProgramThe following sample program assumes that QuickDraw GX is installed, that at least two printers are set up, and that their icons are on the desktop:
*** Beginning of sample program IF SYS(1038) desktop=SUBSTR(SYS(2033),1,AT(':',SYS(2033)))+"\Desktop Folder\" numPrinters=ADIR(prtList, desktop+"*.*",'','dvcf') SET LIBRARY TO HOME()+"FoxTools.cfm" ADDITIVE FOR x=1 TO numPrinters SET PRINTER TO NAME JustCSName(desktop+prtList[(x),1]) REPORT FORM "somereport.frx" NOEJECT NOCONSOLE TO PRINTER ? SET("Printer",2) ENDFOR SET LIBRARY TO ENDIF *** End of sample program Program CommentaryThe first line in the program checks to see if QuickDraw GX is installed by using the SYS(1038) function. The second line determines the name of the Macintosh's hard drive by using the SYS(2033) function, and appends "Desktop Folder" to it. The third line checks to see how many QuickDraw GX printer icons are on the desktop and stores their names in an array named "prtList". The 'dvcf' in the fourth argument of the ADIR() function is the creator type of the QuickDraw GX printer icons. The fourth line loads the FoxTools.cfm library, which is necessary for the use of the JustCSName function. The fifth line is the beginning of a FOR loop that executes once for each QuickDraw GX printer icon found on the desktop. The sixth line (the first one in the FOR loop) sets the printer to one of the QuickDraw GX printers found on the desktop. The seventh line prints a predefined report. The eighth line reports the name of the current QuickDraw GX printer to the current output device (the Visual FoxPro screen).
REFERENCESFor additional information, please see the following articles in the Microsoft Knowledge Base:
ARTICLE-ID: Q152396 TITLE : How To Determine if QuickDraw GX Is Loaded Using SYS Function ARTICLE-ID: Q153155 TITLE : How To Use New Undocumented Foxtools Function JustCSName() ARTICLE-ID: Q153528 TITLE : SET PRINTER TO Enhancements in Visual FoxPro for Macintosh |
Additional reference words: 3.00b VFoxMac
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |