General information
Title:
RTF printing on WIN2000 machine
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
View the map of this thread
View the map of this thread starting from this message only
View all messages of this thread
View all messages of this thread starting from this message only