Printer driver selection

488 views
Skip to first unread message

Pedro

unread,
Mar 15, 2013, 2:41:47 AM3/15/13
to multisoft...@googlegroups.com
Can anyone spot the error in this simple printing program.  It is a problem that I've been having since the GUI printing enhancements became available in Flagship 7 (or was it 6, I forget which). The background info is; using Flagship 7.01.19a for MS-VC6++ on windows 8. Earlier releases of Flagship and all versions of windows back to XP produced the same problem.

*% TESTPRINT.PRG 15/03/2013  TESTING PRINT DRIVER SELECTION PROBLEM.
oPrinter:Setup()
IF oPrinter:SetupAborted
    RETURN
ENDIF
mydriver := oPrinter:Driver
FOR mycounter=1 to 3
    oPrinter:Driver := mydriver
    PrintGui(.T.)
    @ 0,1 SAY 'DOCUMENT ' + STR(mycounter,1)
    PrintGui()
NEXT mycounter
RETURN

Run this and select a printer that IS NOT your default printer. Document 1 will go to the selected printer but document 2 and 3 will print to your default printer. Using the debugger I verified that oprinter:driver was being correctly set each time, but it appears to me that PrintGui() ignores this setting and uses some 'deeper' (inaccessible) variable to hold the driver reference.  On a similar issue - does anyone know if we can access the 'print duplex/doublesided' flag in the printer settings through Flagship?
Thanks in advance.

Paul

unread,
Jul 11, 2020, 9:53:12 AM7/11/20
to multisoft...@googlegroups.com
In MS-Windows, overriding the default setting is not supported. But when you have set default printer via "Devices and Printers", you may avoid the setup dialog by

  set printer off
  set device to print
  oPrinter:Driver := 'anything'
  oPrinter:GUIstart()
  PrintGui(.T.)
  ... your ?, ?? or @..SAY output
  PrintGui()


Best regards,
Paul

Reply all
Reply to author
Forward
0 new messages