Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Printing Rich Text Format Control contents
Message
 
To
04/10/1998 10:39:20
Alan Mcmillen
John Henderson Limited
Belfast, United Kingdom
General information
Forum:
Visual FoxPro
Category:
Other
Miscellaneous
Thread ID:
00143695
Message ID:
00143730
Views:
23
Hi Alan,

I use the following code:
*==================================================
* Print the text of a RichText control
*==================================================
LParameter toRTF, tcPrinter, tcDoc
   
   *-----------------------------------------------
   * 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

   *-----------------------------------------------
   * 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
Christof


>Myself and a colleague have been having difficulties printing a the contents of an RTF control at runtime in Visual Foxpro. We have been trying to use a common dialog box using the windows print control and utilising the SelPrint property of the RTF box, but without much success. Could anyone give me any ideas has to an efficient way of accomplishing this.
>
>If anyone has any ideas this week, could they please forward their replies to Michael Buckley (michael.buckley@john-henderson.co.uk). He is currently registered with this service.
>
>Many thanks ......
>
>Alan McMillen
--
Christof
Previous
Reply
Map
View

Click here to load this message in the networking platform