Dear Mr.James,
Thankyou for the solution, but did not serve the purpose
As per the function I am getting a return Value 0, eventhough the printer is switched off
- Code: Select all Expand view
nStatus := PrnStatus( QuePrinter )
if nStatus < 1 ; return "Printer OK" // ie Impressora OK
I expect nStatus value to be 128 when the printer is switched off/offline
- Code: Select all Expand view
elseif nStatus = 128 ; return "Printer OFFLINE"
I even tried to make use of PrintRawFile() to print an empty Txt file and return a value so that I could identify whether the printer is online or not,
but failed, I am getting a return value 1 from PrintRawFile()
- Code: Select all Expand view
*------------------------------------------*
Function TestPrn()
*------------------------------------------*
Local nPrn,cFileName:="D:\WinAcs\MyText.Txt"
MsgInfo(isprint(PrnGetName()) )
nPrn := PrintFileRaw(PrnGetName(),cFileName, "Test for PrintFileRaw()")
MsgInfo("Entered TestPrn, value of nPrn is "+str(nPrn))
IF nPrn < 0
DO CASE
CASE nPrn = -1
Alert(cMess+"Incorrect parameters passed to function")
CASE nPrn = -2
Alert(cMess+"WINAPI OpenPrinter() call failed")
CASE nPrn = -3
Alert(cMess+"WINAPI StartDocPrinter() call failed")
CASE nPrn = -4
Alert(cMess+"WINAPI StartPagePrinter() call failed")
CASE nPrn = -5
Alert(cMess+"WINAPI malloc() of memory failed")
CASE nPrn = -6
Alert(cMess+"WINAPI CreateFile() failed - File "+cFileName+" not found??")
OTHERWISE
Alert(cFileName+" PRINTED OK!!!?")
ENDCASE
ENDIF
I have modified the Class TDosPrn and TTxtPreview (adopted from Ralph in spanish forum) so that the class work more intelligently by identifying the type of the printer selected by the user and accordingly print in Graphics mode or Text Mode.
Now the modified class will handle printing to LPT port even without
mapping the LPT port. I thought that it would be much more better if I could make the class to check whether the Printer is Offline or Online.
I know that the Printer spooling system will handle the printing later if the printer is offline. Spooler will start printing, the moment printer is switched on.
Regards
Anser