Information générale
Titre:
Disconnected from network, how to test printer status.
We print reports with Crystal
We use FOXTOOLS GetProStrg to get the printer port and driver
which is passed to Crystal with the following code:
keyboard '{ENTER}'
lcPrinter=getprinter()
lcSection="Devices"
lcDefault=""
lcBuffer=space(200)
lnLength=len(lcBuffer)
lnLength=GetProStrg(lcSection,lcPrinter,lcDefault,@lcBuffer,lnLength)
jcResult=left(lcBuffer,lnLength)
jcPort=substr(jcResult,at(",",jcResult)+1)
jcDriver=ForceExt(left(jcResult,at(",",jcResult)-1),"DRV")
WITH THISFORM.OleCrystal
.PrinterName=lcPrinter
.PrinterPort=jcPort
.PrinterDriver=jcDriver
The problem that I encounter:
All my printers are network printers,
Usually the program is run, connected to the network, all OK.
At times, I need to run, while not conected to the network,
GetProStrg returns my network printer, which is not connected.
This causes various errors, sometimes crashing my program.
Before running this code, the user indicates if they want
to print or preview.
I preview I can assign
WITH THISFORM.OleCrystal
.PrinterName=''
.PrinterPort=''
.PrinterDriver=''
This avoids the errors, but
1) Crystal preview has a print option,
which will then not print even if there is a printer on-line
2) All subsequent printing, does not print.
Question: How can I test the port returned by GetProStrg
to see if it is online and accessable?
SYS(13) returns ON
Any help would be appreciated,
Shlomo
Suivant
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement