Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
RTF printing on WIN2000 machine
Message
From
01/01/2001 18:14:25
Eric De Bruin
Basic Software Design
Netherlands
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Troubleshooting
Title:
RTF printing on WIN2000 machine
Miscellaneous
Thread ID:
00458335
Message ID:
00458335
Views:
50
I got this code for printing RTF text. It works fine under WIN9x but not on WIN2000.

Everthing seems to work normal but nothing gets printed. Even the printicon on the windows taskbar appears but when you dubbleclick it there's nothing in the printqueue.


Is there anybody who knows wat goes wrong ?


THANKS IN ADVANCE

ERIC DE BRUIN


*---------------- ORIGINAL CODE SUPPLIED TO ME BY SCOTT BUTT --------------

*The following code is from Christof Lange :
*!* FUNCTION RichTextPrint
*==================================================
* Print the text of a RichText control
*==================================================
LPARAMETER tortf, tcprinter, tcdoc

IF !(TYPE('tortf') = "O")
lcmsg = "No RTF Object Passed Process Aborted"
MESSAGEBOX(lcmsg,mb_iconstop,"IMS-System Message")
RETURN
ENDIF
*-----------------------------------------------
* Declare some DLLs
*-----------------------------------------------
DECLARE INTEGER StartDoc IN Win32Api ;
INTEGER, STRING
DECLARE INTEGER StartPage IN Win32Api INTEGER
DECLARE INTEGER EndPage IN Win32Api INTEGER
DECLARE INTEGER EndDoc IN Win32Api INTEGER
DECLARE INTEGER CreateDC IN Win32Api ;
STRING, STRING, INTEGER, INTEGER
DECLARE INTEGER DeleteDC IN Win32Api INTEGER
DECLARE INTEGER HeapCreate IN Win32Api ;
INTEGER, INTEGER, INTEGER
DECLARE INTEGER HeapDestroy IN Win32Api INTEGER
DECLARE INTEGER HeapAlloc IN Win32Api ;
INTEGER, INTEGER, INTEGER
DECLARE INTEGER HeapFree IN Win32APi ;
INTEGER, INTEGER, INTEGER
DECLARE lstrcpy IN Win32Api INTEGER, STRING

*-----------------------------------------------
* Choose a printer
*-----------------------------------------------
LOCAL lcprinter
IF pcount() < 2
lcprinter = GETPRINTER()
* 04-11-2000 SEB
DECLARE _fpreset IN msvcrt20.DLL && reset the math coprocessor, avoid
=_fpreset() && Exception 10H error
ELSE
lcprinter = tcprinter
ENDIF
IF pcount() < 3
tcdoc = tortf.selrtf
ENDIF

*-----------------------------------------------
* Print
*-----------------------------------------------
LOCAL lnheap, lndoc, lcstruct, lnhdc
IF NOT EMPTY( lcprinter )
lnhdc = createdc("WINSPOOL",lcprinter,0,0)
lnheap = heapcreate(0, 8192, 8192)
lndoc = heapalloc( lnheap, 0, LEN(tcdoc)+1 )
lstrcpy( lndoc, tcdoc )
lcstruct = toint(12)+toint(lndoc)+toint(0)
startdoc( lnhdc, lcstruct )
startpage( lnhdc )
tortf.selprint( lnhdc )
endpage( lnhdc )
enddoc( lnhdc )
deletedc( lnhdc )
heapfree(lnheap, 0, lndoc)
heapdestroy(lnheap)
ENDIF

*==================================================
* Convert into an integer
*==================================================
FUNCTION toint
PARAMETER tnvalue
PRIVATE cstring, nt
cstring =''
FOR nt = 1 TO 4
cstring = cstring +CHR(tnvalue%256)
tnvalue = INT(tnvalue /256)
ENDFOR
RETURN cstring
Reply
Map
View

Click here to load this message in the networking platform