Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printer GPFs
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
FoxPro 2.x
Titre:
Divers
Thread ID:
00040866
Message ID:
00040890
Vues:
27
>I'm updating an ancient program that prints checks in FP2.6 for Windows using ??? syntax to
>access the printer directly. Problem is that whenever I issue SET PRINTER TO (nothing or LPT1 or File)
>after this type of output FP GPFs.
>
>I've tried a few variations, and using SET PRINTER TO, SET PINT ON ... SET PRINT OFF, SET PRINTER TO
>and using ?? works, but unfortunately the printer driver gets in the way with this in terms of how
>the text is spaced (not using the printer's defaults).
>
>So, anybody know of a way to use ??? and *not* GPF everytime the printer is reset?
>
>+++ Rick ---
Rick we have to initialize ort HP Laserjet II's from the program using the following code:

***********
*
* Initialize printing environment
*
SET HEADING OFF
SET CONSOLE OFF

*
* set output from screen to printer
*
SET DEVICE TO PRINTER
SET PRINTER ON

*
* Open ADL Report file
*
file_ptr = FOPEN(tmp_file,0)

IF file_ptr = -1
=errormsg("FOPEN error with ADL Report file during printing to Laserjet")
RETURN 0
ENDIF

x = 1
y = 0
prev_char = ""

DO WHILE .NOT. FEOF(file_ptr)
m_char = FREAD(file_ptr, 1)

*
* Check for special characters
*
DO CASE
CASE m_char == PC_8
??? HP_PC8
CASE m_char == T_MARGIN
??? HP_TMARGIN
CASE m_char == L_MARGIN
??? HP_LMARGIN
CASE m_char == RESET
??? HP_RESET
CASE m_char == FIXED_SPACE
??? HP_FSPACE
CASE m_char == PORTRAIT
??? HP_PORT
CASE m_char == PITCH_SET
??? HP_PITCH
CASE m_char == VERT_SPACE
??? HP_VSPACE
CASE m_char == FORMFEED
x = 1
y = 0
CASE m_char == NEWLINE
IF prev_char == PC_8
_PLINENO = 1
ELSE
? ""
x = x+ 1
y = 0
ENDIF
CASE m_char == BS
**y = y - 1
CASE m_char == UNDERLINE
**@ x,y SAY UNDERLINE
**y = y + 1
CASE m_char == CHR(225)
IF prev_char == CHR(225)
@ x,y SAY total_pages
y = y + 2
ENDIF
CASE m_char == UL_MARK
**@ x,y SAY UNDERLINE
@ x,y SAY UL_MARK
y = y + 1
CASE m_char == VL
@ x,y SAY VL
y = y + 1
OTHERWISE
@ x,y SAY m_char
y = y + 1
ENDCASE

prev_char = m_char
ENDDO

=FCLOSE(file_ptr)

EJECT

*
* Set device back to screen and flush printer
*
SET PRINTER OFF
SET PRINT TO
SET DEVICE TO SCREEN
SET CONSOLE ON
SET HEADING ON

RELEASE x, y, prev_char

****
Dont know if this helped but it is how we use ??? in relation to printer setup.
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform