If I use PRINTDLG to select a printer, how can I capture the printer name so I can use it in an OPEN statement?
You can capture printer name:...
TYPE(T_DEVMODE):: DM; POINTER(pDM, DM)
!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?