Sudden Print Issues

This forum is for general support of Xbase++
Post Reply
Message
Author
Stuart.Fraser
Posts: 17
Joined: Thu Jan 28, 2010 10:07 am
Location: Victoria, BC Canada
Contact:

Sudden Print Issues

#1 Post by Stuart.Fraser »

Hello All,

I have an issue with a very old Xbase++ application that has suddenly stopped printing. This application has been updated as far as being compiled in the latest versions of Xbase but the code has not changed in years. Last month it was working fine and this month some of the routines will not print. This application is deployed on government managed workstations and I suspect some change to the environment is breaking some of the reports. This application is still running in a mix of full GUI and hybrid windows. It has since been replaced with a Siebel CRM solution however it is being kept on line for historical reasons as some of the cases in the system are still active.

From my investigation the reports that won't work are the ones coming from the hybrid (i.e. older) parts of the system. The print routines associated with these are very old and are sending control characters down to the printer and using Set Printer to They go like this:

//elsewhere in the app
PUBLIC cPuCompOn := chr(27)+'&k2S'
PUBLIC cPuCompOff := chr(27)+'&k0S'
PUBLIC cPuPortrait := CHR(27) + '&l0O'
PUBLIC cPuLandscape := chr(27) + '&l1O'
PUBLIC cPuLetter := CHR(27)+'&l2A'
PUBLIC cPuLegal := chr(27)+'&l3A'
PUBLIC cPu6LPI := chr(27)+'&l6D'
PUBLIC cPuReset := chr(27) + "E"
PUBLIC cPuPort := DefPrinter()
//end

//--------------------------------------------------------------------
Function Printer( cRequest )
//--------------------------------------------------------------------

Local cRq := Upper( cRequest )


Do Case
Case cRq = "CLOSE"
Set Printer To

Case cRq = "OPEN"

cPuPort:=IIf(At(":",cPuPort) > 0, Left(cPuPort, Len(cPuPort)-1),cPuPort)
//cPuPort:= Left(cPuPort, Len(cPuPort)-1)
Set Printer To &cPuPort

//Set( _SET_PRINTER,cPuPort) // Printer To &cPuPort WinNT

SetPRC(0,0)
ControlPrinter( cPuReset )

Case cRq = "COMPON"
ControlPrinter( cPuCompOn )

Case cRq = "COMPOFF"
ControlPrinter( cPuCompOff )

Case cRq = "6LPI"
ControlPrinter( cPu6LPI )

Case cRq = "BOLDON"
ControlPrinter( cPuBoldOn )

Case cRq = "BOLDOFF"
ControlPrinter( cPuBoldOff )

Case cRq = "LETTER"
ControlPrinter( cPuLetter )

Case cRq = "LEGAL"
ControlPrinter( cPuLegal )

Case cRq = "LANDSCAPE"
ControlPrinter( cPuLandscape )

Case cRq = "PORTRAIT"
ControlPrinter( cPuPortrait )

Case cRq = "RESET"
ControlPrinter( cPuReset )

OtherWise
WarnBox("You blew it gringo")

EndCase

Return nil






//-------------------------------------------------------------------
Function ControlPrinter( cEscSeq )
//------------------------------------------------------------------

LOCAL nRow := PRow(), nCol := PCol()
Local lCon := Set(_SET_CONSOLE, .f. )
Local lPrnt := Set(_SET_PRINTER, .T. )
Local cDev := Set(_SET_DEVICE, "PRINTER" )

?? cEscSeq

Set( _SET_CONSOLE, lCon )
Set( _SET_PRINTER, lPrnt )
Set( _SET_DEVICE, cDev )

RETURN SetPrc( nRow, nCol )

My question is, can anyone think of what might have changed in their environment (windows 7) that would suddenly cause these routines to fail after years of working just fine.

Thanks.

Stu

Post Reply