General information
Category:
ActiveX controls in VFP
*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()
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
Previous
Next
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