Hello All:
This works using Crystal Reports and Windows 98:
use FOXTOOLS to get the Printer Driver and the Printer Port to use as Crystal SelectPrinter variables.
oReport.SelectPrinter(lcPrinterDriver,lcPrinterName,lcPrinterPort)
The code to use FoxTools is at the bottom of this message.
lcPrinterName is the Windows Printer Name.
But, in Windows 2000, the Printer Driver returned by FOXTOOLS is always WINSPOOL.
How does one go about getting the actual printer driver used by Windows?
Thanks in advance,
Rick
Sample Code:
lcPrinterDriver=""
lcPrinterPort=""
lcbuffer = SPACE(500)
lnlength = LEN(lcbuffer)
IF x2setlib("FOXTOOLS")
lnlength = GetProStrg('devices',lcPrinterName,"",@lcbuffer,lnlength)
ENDIF
lcbuffer=ALLTRIM(lcbuffer)
lncomma1=AT(",",lcbuffer,1)
IF lncomma1<>0
lcPrinterDriver=ALLTRIM(LEFT(lcbuffer,lncomma1-1))
lcPrinterPort=ALLTRIM(RIGHT(lcbuffer,LEN(lcbuffer)-lncomma1))
ENDIF
oReport.SelectPrinter(lcPrinterDriver,lcPrinterName,lcPrinterPort)
Richard DeZeeuw
DeZeeuw Software Inc.