Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

pole display

Status
Not open for further replies.

shsimjee

Programmer
May 2, 2012
5
shsimjee (Programmer) 18 Jul 12 3:41
i am writing to a pole display (com1) from my clipper program
when i was using windows 98 the message used to write to the
pole display. since changing to windows xp i get an error
error term/0 print error quit / retry. how do i overcome this error.
if i mode com1:96,n,8,1 then do a dir > com1
the pole display will display the directory but from my program
this error occurs
attach sample of my program

#include "Inkey.ch"
#include "TButils.ch"
#include "Setcurs.ch"
#include "CMX.CH"
Mdate := TODAY := MRDATE := DATE()
PUBLIC nT,nL,nB,nR
cBox := dBox := mBox := oBox := sBox := ' '
nT:=nL:=nB:=nR:=nqty:=namt:=ntot:=0
cDes := nTyp := ' '
Set HEADING off ; Set safety off
Set DECIMALS to 2 ; Set date British
Set FIXED on ; Set DELETE on
Set TALK off ; Set BELL off
Set INTENSITY on ; set EXCLUSIVE off
Set CENTURY on ; set EPOCH TO 1970
SET function 10 to '' ; SET EXACT OFF
**
If ISCOLOR()
cSays = "BG+/B,GR+/BG,G,,GR+/BG"
cBox = "W+/B,GR+/BG,G,,N/BG"
cGets = "W+/B,GR+/BG,G,,GR+/BG"
cAlert := "W+/R,GR+/BG,,,W+/R"
Else
cBox = "W"
cSays = "W/N, N/W"
cGets = "W/N, N/W"
cAlert := "W/N,N/W,,,W/N"
Endif
**
Fram_d = chr(201)+chr(205)+chr(187)+chr(186)+;
chr(188)+chr(205)+chr(200)+chr(186)+chr(255)

Fram_s = Chr(218)+chr(196)+chr(191)+chr(179)+;
Chr(217)+chr(196)+chr(192)+chr(179)+chr(255)

Fram_ds = chr(213)+chr(205)+chr(184)+chr(179)+;
chr(190)+chr(205)+chr(212)+chr(179)+chr(255)

Fram_sd = chr(214)+chr(196)+chr(183)+chr(186)+;
chr(189)+chr(196)+chr(211)+chr(186)+chr(255)
**
cdspport := "COM1" && Display port
cDspType := "1"
SETCOLOR(cSays)
CUS_DISP(,,,,"6")
Return
****************************************
FUNCTION Cus_Disp(cDes,nQty,nAmt,nTot,nTyp)
LOCAL nRow,nCol
nRow := PROW()
nCol := PCOL()
nDes := If(cDes==NIL,space(20),cDes)
nQty := If(nQty==NIL,space(6),IF(substr(str(nQty,6,2),5,6)=="00",str(nQty,5,0)+" ",str(nQty,6,2)))
nAmt := If(nAmt==NIL,space(6),str(nAmt,6,2))
nTot := If(nTot==NIL,space(7),str(nTot,7,2))
nTyp := If(nTyp==NIL,"1",nTyp)
SET printer to &cdspport
SET DEVICE to PRINT
SET printer on
set console off
Do Case
Case nTyp == "1"
? PADC(nDes,20," ")+nQty+nAmt+nTot
Case nTyp == "2"
? PADC("TOTAL",20," ")+PADC(nTot,19," ")
Case nTyp == "3"
? space(20)+space(21)
Case nTyp == "4"
? PADC("Amt Tendered",20," ")+PADC(nTot,19," ")
Case nTyp == "5"
? PADC(PADC(" CHANGE :"+nTot,19," ")+"Tendered :"+nAmt,20)
Case nTyp == "6"
? PADC("Please",20," ")+PADC("Next Customer",19," ")
Case nTyp == "7"
? space(20)+space(19)
Endcase
SETPRC(nRow,nCol)
set printer off
Set Printer to
set console on
SET DEVICE to SCREEN
Return .T.

 
Hi Shsimjee

It would really be helpful to know at which line you are getting the error. However, this may be getting lost since console is off.

Maybe you can insert some debug lines in your code:
In the initialization section:
xdbg:='@echo Debug starts:'+ctod(date())+' '+time()+' > xdbg.txt'
run &xdbg

In your Cus_Disp function, at strategic places, eg:
xdbg:='@echo Cus_Disp about to call Prow() >> xdbg.txt'
run &xdbg

This will create a disk file called xdbg.txt which should trace how far the program gets before crashing, to determine where exactly it happens.

I am on Linux now so can't test Clipper, so can only offer a couple of possible reasons:
- prow() and pcol are not initialized. Set up the printer in initializaion section and try an EJECT or use setprc() function.
- on the XP box, define a printer (even just a dummy text only) on port COM1. XP may be trying to interrogate the printer driver and not finding a printer on that port so returning an error.

Without XP here cannot test, so possibly this is unhelpful.

Jock
 
Hi again

One thing I forgot to ask: Is there anything in the XP event logs at the time you are getting your error?

Jock
 
Is the COM-port properly initialized before you start the Clipper application?
 
I'm wondering if this is a file handles problem?

On XP there might not be an open handle for the comms port, and the
standard is probably only about 20...

That would mean from a DOS prompt it might work, but from within
Clipper with some tables already open it might not...

Regards

Griff
Keep [Smile]ing

There are 10 kinds of people in the world, those who understand binary and those who don't.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top