Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printing Problem
Message
De
28/12/2004 03:32:24
Yim Ming Sun Derek
Spacious Design Consultant
Hong Kong, Hong Kong
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Fonctions Windows API
Titre:
Printing Problem
Versions des environnements
Visual FoxPro:
VFP 6 SP5
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
00972496
Message ID:
00972496
Vues:
94
Hi,
I want to print the bar code with my client record, but the bar code is printed
by calling the API dll library function use STARTDOC, STARTPAGE, ENDPAGE, ENDDOC.
I find that it cannot print out the client record but only the bar code.

Can I use set print on/off with the Window GDI Printing function ?

Please advise.

For example
cpPrn = SET("PRINTER", 2)
set printer to Name (cpPrn)
set print on
SET PRINTER FONT "Arial", 10, "N"
clear dlls
localAddDotsToSpace = 0
localAddDotsToBar = 0
declare LONG GetDeviceCaps in gdi32.dll LONG, LONG
declare SHORT DeleteDC in gdi32.dll LONG
declare LONG CreateDC in gdi32.dll STRING, STRING, STRING
declare INTEGER StartDoc in gdi32.dll LONG, STRING
declare INTEGER StartPage in gdi32.dll LONG
declare INTEGER EndPage in gdi32.dll LONG
declare INTEGER EndDoc in gdi32.dll LONG
declare LONG GetBarCodeSize in BCLW32.DLL as GetBarCodeSize LONG winDC, LONG hbc, STRING bcData, STRING hrData
declare INTEGER DrawBarCodeToHDC in BCLW32.DLL as DrawBarCodeToHDC LONG WinDc, INTEGER nXdpi, INTEGER nYdpi, INTEGER nAlign, LONG hBC, STRING @cRepCaseNo, STRING @cRepCaseNo
declare INTEGER DeleteBarCode in BCLW32.DLL as DeleteBarCode LONG hBC
hPrn = CreateDC("WINSPOOL",cpPrn,[])
xDpi = GetDeviceCaps(hPrn,88)
yDpi = GetDeviceCaps(hPrn,90)
ctDoc = Long2Str(20) + REPLICATE(CHR(0), 16)
=StartDoc(hPrn, @ctDoc)
=StartPage(hPrn)

USE CLIENT
SEEK "GD0001"
* print out the client no. and name
? CLIENT->cusno
? CLIENT->cusname
...
* print out the bar code
error=DrawBarCodeToHDC(hPrn,2000,ypos, alignment,hBC,cbarcode,cbarcode)
=EndPage(hPrn)
=EndDoc(hPrn)
set print off
DeleteBarCode(hBC)
lPrn=DeleteDC(hPrn)
clear dlls

FUNCTION Long2Str
PARAMETERS m.longval
PRIVATE i, m.retstr
m.retstr = ""
FOR i = 24 TO 0 STEP -8
	m.retstr = CHR(INT(m.longval/(2^i))) + m.retstr
	m.longval = MOD(m.longval, (2^i))
NEXT
RETURN m.retstr
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform