Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing in Rich Text
Message
From
11/04/2000 10:18:32
Scott Butts
Ims Specialty Services
Twin Falls, Idaho, United States
 
 
To
11/04/2000 09:33:59
General information
Forum:
Visual FoxPro
Category:
ActiveX controls in VFP
Miscellaneous
Thread ID:
00357942
Message ID:
00358001
Views:
27
*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
Map
View

Click here to load this message in the networking platform