printing

printing

Community Admin's picture

If I use PRINTDLG to select a printer, how can I capture the printer name so I can use it in an OPEN statement?

2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.
Jugoslav Dujic's picture

You can capture printer name:...

TYPE(T_DEVMODE):: DM; POINTER(pDM, DM) 
CHARACTER(32):: szPrinter 
TYPE(T_PRINTDLG):: PD 
 
!Initialize PD here... 
IF (PrintDlg(PD)) THEN 
    pDM = GlobalLock(PD%hDevMode) 
    szPrinter = DM%dmDeviceName 
    szPrinter = szPrinter(1 : INDEX(szPrinter, CHAR(0))-1) 
   ... 

... but you can't use it in an OPEN statement. The best you can get with Fortran RTL is to OPEN(...FILE="PRN"), but that will always print to the default printer. What kind of output do you want to print?

Jugoslav www.xeffort.com

Login to leave a comment.