HMG CONSOLE APPLICATION ARE NOT PRINTING IN WINDOWS-8 64BIT

HMG Samples and Enhancements

Moderator: Rathinagiri

Post Reply
manoj_duamzn
Posts: 21
Joined: Fri Aug 30, 2013 5:38 am

HMG CONSOLE APPLICATION ARE NOT PRINTING IN WINDOWS-8 64BIT

Post by manoj_duamzn » Thu Oct 10, 2013 5:10 am

I converted my clipper console application to HMG console application and build application file with HMG-IDE.

I am facing following problems. Kindly help me for following problems.

1. I used win_printfileraw(win_printergetdefault(),'report.txt')
to print any report in dot matrix printer. It is working in Windows-XP perfectly. but not printing in Windows 8 64-bit.

2. I used HB_GTINFO.CH to make full screen, colour effect and font name & size. which are not working in any Window (os)

How can I start printing in Windows-8 64 bit. Beside this Kindly also tell me how can I give print on Laser printer because it is not printing on Laser Printer on both windows. I want to say you that I have ESC/P codes CHR(15) CHR(18) etc. Is they are making problem on Laser Printer. Please help me.


I have used following lines in coding

REQUEST HB_GT_WIN_DEFAULT
#include "hbgtinfo.ch"
#define RGB(r,g,b) (r+(g*256)+(b*256*256))

**************
PROCEDURE MAIN
**************
LOCAL aPalette:=hb_gtinfo(HB_GTI_PALETTE)
SETMODE(25,80)
USE COLOR SHARED
STORE BACKCOLOR1 TO BCOL1
STORE BACKCOLOR2 TO BCOL2
STORE BACKCOLOR3 TO BCOL3
STORE FORCOLOR1 TO FCOL1
STORE FORCOLOR2 TO FCOL2
STORE FORCOLOR3 TO FCOL3
CLOSE ALL
aPalette[1] := RGB(BCOL1,BCOL2,BCOL3)
aPalette[8] := RGB(FCOL1,FCOL2,FCOL3)
HB_GTINFO(HB_GTI_FONTSIZE,24)
HB_GTINFO(HB_GTI_FONTWIDTH,12)
HB_GTINFO(HB_GTI_FONTNAME,'Lucida Console')
HB_GTINFO(HB_GTI_WINTITLE,'Dua Softwares')
HB_GTINFO(HB_GTI_ISFULLSCREEN,.T.)
HB_GTINFO(HB_GTI_PALETTE,aPalette)
HB_GTINFO(HB_GTI_ISFULLSCREEN,.T.)
HB_GTINFO(HB_GTI_ALTENTER,.T.)

Kindly help me.

REGARDS,

MANOJ DUA

jayadevu
Posts: 218
Joined: Tue May 19, 2009 7:10 am
Been thanked: 9 times

Post by jayadevu » Thu Oct 10, 2013 5:25 am

Hi,

Show us your code for printing.

Warm regards,

Jayadev

manoj_duamzn
Posts: 21
Joined: Fri Aug 30, 2013 5:38 am

Post by manoj_duamzn » Thu Oct 10, 2013 8:26 am

jayadevu wrote:Hi,

Show us your code for printing.

Warm regards,

Jayadev
Code is very big and calls many procedure I am trying to display main portion
SET PRINTER TO REPORT.TXT
SET DEVICE TO PRINT
SET PRINTER ON
DO PRNINV
SET PRINTER OFF
SET DEVICE TO SCREEN
SET PRINTER TO
WIN_PRINTFILERAW(WIN_PRINTERGETDEFAULT(),`REPORT.TXT')
RETURN

****************
PROCEDURE PRNINV
****************
STORE NUMB0 TO PLEN
STORE NUMB1 TO CNT
STORE '' TO CVT
STORE VARFAL TO ITSUPPOK,SUBTOT
DO UPDPLEN&PERF
DO WHILE CNT<=NOC
SETPRC(NUMB0,NUMB0)
STORE NUMB0 TO ICNT,RICNT,COUNTER,TQTY,TFQTY,TAMT,RTAMT,TTAMT,SATAMT,TTAX,TDSAMT,TVATAMT1,TVATAMT2,TVATAMT3,TVATAMT4,TVSLAMT1,TVSLAMT2,TVSLAMT3,TVSLAMT4,TSATAMT1,TSATAMT2,TSATAMT3,TSATAMT4,SDTSALE,BAMOUNT,RAMOUNT,TINTAMT,RINTAMT,TWVALUE
STORE NUMB1 TO PNO
STORE VARFAL TO PAGEBRK
STORE ' ROUNDED OFF' TO RS
STORE '' TO RSWORD
OD='ORIG'
OD1='ORIGINAL COPY'
IF CNT=NUMB2 .OR. CNT=NUMB4 .OR. CNT=NUMB6 .OR. CNT=NUMB8 .OR. CNT=10 .OR. CNT=12
OD='DUP.'
OD1='DUPLICATE COPY'
ELSEIF CNT=NUMB3
OD='OFF.'
OD1='OFFICE COPY'
ENDIF
IF MULTIINV
IF ODO='1'
OD='ORIG'
OD1='ORIGINAL COPY'
ELSEIF ODO='2'
OD='DUP.'
OD1='DUPLICATE COPY'
ELSEIF ODO='3'
OD='OFF.'
OD1='OFFICE COPY'
ENDIF
ENDIF
IF ODYN=NO
OD=FOUR
OD1=SPACE(14)
ENDIF
DO INVHEAD&PERF
NETUSE("ITEMTR&CC")
SET INDEX TO VITTR&CC
SEEK 'S'+SINO
DO WHILE VOUTYPE='S' .AND. BOOK=IBOOK .AND. VNO=INO .AND. .NOT. EOF()
IF COUNTER>PLEN
PAGEBRK=VARTRUE
DO INVBOTT&PERF
DO INVHEAD&PERF
PAGEBRK=VARFAL
ENDIF
EXP=SPACE(NUMB6)
EXP1=FIVE
IF .NOT. EMPTY(EXPIRY)
EXP=SUBSTR(CMONTH(EXPIRY),NUMB1,NUMB3)+ONE+SUBSTR(LTRIM(STR(YEAR(EXPIRY),NUMB4,NUMB0)),NUMB3,NUMB2)
EXP1=STR(MONTH(EXPIRY),NUMB2,NUMB0)+'/'+SUBSTR(STR(YEAR(EXPIRY),NUMB4,NUMB0),NUMB3,NUMB2)
ENDIF
SICNT=LTRIM(STR(ICNT+NUMB1,NUMB3,NUMB0))+'.'
IF LEN(SICNT)<NUMB4
SINCT=SICNT+SPACE(NUMB4-LEN(SICNT))
ENDIF
INETAMT=AMOUNT+TTAMOUNT+SATAMOUNT-DISCOUNT+TAXAMOUNT
DO PITPRN&PERF
DO ITEMTOTAL
TINTAMT=TINTAMT+INETAMT
SKIP
ENDDO
IF ICNO>NUMB0 .AND. BRTAMT>NUMB0
STORE NUMB0 TO ICNT
IF (COUNTER+NUMB3)>PLEN
PAGEBRK=VARTRUE
DO INVBOTT&PERF
DO INVHEAD&PERF
PAGEBRK=VARFAL
ENDIF
IF PERF='1 ' .OR. PERF='2' .OR. PERF='4' .OR. PERF='5' .OR. PERF='6' .OR. PERF='8' .OR. PERF='12'
COUNTER++
@ COUNTER,NUMB0 SAY UON+'GOODS RETURN'+UOF
@ COUNTER,13 SAY ':'
IF PERF='4'
IF DOUBLE=YES
@ COUNTER,67 SAY VL
@ COUNTER,69 SAY UON+'GOODS RETURN'+UOF
@ COUNTER++,82 SAY VL
ENDIF
ELSEIF PERF='8'
IF P8DSPYN<>YES
@ COUNTER, 67 SAY VL
ENDIF
IF DOUBLE=YES
@ COUNTER,69 SAY UON+'GOODS RETURN'+UOF
@ COUNTER,82 SAY VL
ENDIF
ENDIF
COUNTER++
ELSEIF PERF='11'
@ COUNTER++,NUMB0 SAY BLLN
@ COUNTER++,NUMB0 SAY '| GOODS RETURN | | | | | | |'
ELSEIF PERF='15'
@ COUNTER++,NUMB0 SAY 'LESS: '+UON+'GOODS RETURN'+UOF
ELSEIF PERF='20'
@ COUNTER++,NUMB0 SAY BLLN
IF IBOOK='REPL'
@ COUNTER++,NUMB0 SAY '| | '+UON+'EXPIRY/BREAKAGE RETURN'+UOF+' | | | | | | | | | | |'
ELSE
@ COUNTER++,NUMB0 SAY '| | '+UON+'GOODS RETURN'+UOF+' | | | | | | | | | | |'
ENDIF
ELSEIF PERF='27'
COUNTER++
IF IBOOK='REPL'
@ COUNTER++,NUMB0 SAY UON+'EXPIRY/BREAKAGE RETURN'+UOF
ELSE
@ COUNTER++,NUMB5 SAY UON+'GOODS RETURN'+UOF
ENDIF
ENDIF
SEEK 'R'+IRBOOK+STR(ICNO,NUMB7,NUMB0)
DO WHILE VOUTYPE='R' .AND. BOOK=IRBOOK .AND. VNO=ICNO .AND. .NOT. EOF()
IF COUNTER>PLEN
PAGEBRK=VARTRUE
DO INVBOTT&PERF
DO INVHEAD&PERF
PAGEBRK=VARFAL
ENDIF
EXP=SPACE(NUMB6)
EXP1=FIVE
IF .NOT. EMPTY(EXPIRY)
EXP=SUBSTR(CMONTH(EXPIRY),NUMB1,NUMB3)+ONE+SUBSTR(LTRIM(STR(YEAR(EXPIRY),NUMB4,NUMB0)),NUMB3,NUMB2)
EXP1=STR(MONTH(EXPIRY),NUMB2,NUMB0)+'/'+SUBSTR(STR(YEAR(EXPIRY),NUMB4,NUMB0),NUMB3,NUMB2)
ENDIF
SICNT=LTRIM(STR(RICNT+NUMB1,NUMB3,NUMB0))+'.'
IF LEN(SICNT)<NUMB4
SINCT=SICNT+SPACE(NUMB4-LEN(SICNT))
ENDIF
INETAMT=AMOUNT+TTAMOUNT+SATAMOUNT-DISCOUNT+TAXAMOUNT
DO PITPRN&PERF
DO ITEMTOTAL
RINTAMT=RINTAMT+INETAMT
RICNT++
ICNT++
SKIP
ENDDO
ENDIF
DO BILLCALC
DO INVBOTT&PERF
CLOSE ALL
NETUSE("INV&CC")
SET INDEX TO IINV&CC
SEEK IBOOK+STR(INO,NUMB7,NUMB0)
RECLOCK()
REPL PRNCOPY WITH PRNCOPY+NUMB1
UNLOCK
CLOSE ALL
CNT++
ENDDO
RETURN

User avatar
mol
Posts: 3253
Joined: Thu Sep 11, 2008 5:31 am
Location: Myszków, Poland
Has thanked: 235 times
Been thanked: 132 times
Contact:

Post by mol » Thu Oct 10, 2013 9:09 am

Sorry, but your code is extreme unreadable.
You should prepare small working sample, test it and attach to this forum.

User avatar
IMATECH
Posts: 174
Joined: Sun May 27, 2012 9:33 pm
Location: Brazil: Goiânia-GO.
Has thanked: 1 time
Been thanked: 3 times

Post by IMATECH » Thu Oct 10, 2013 10:33 am

Hi manoj_duamzn !


1: If you have a Laser printer from EPSON ( with esc/p support ) I see no problem
But if you are using another type ( HP pcl, etc... ) will never work using esc/p codes

2: WinPrintFileRaw only works with printer that support it ( raw mode: check properties )

3: Try to study this link, will see an option to print text files to pdf ( flat files without esc/p commands )
viewtopic.php?f=35&t=2513



Regards
M., Ronaldo

By: IMATECH

Imation Tecnologia

Post Reply