Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to print the content of a RichText activex using the Selprint function.

API Functions

How to print the content of a RichText activex using the Selprint function.

by  Mike Gagnon  Posted    (Edited  )
[ol][li]In your main program declare the required API (If their are not already declared). These API will allow you to get the numeric handle of your printer, which is a required parameter for the SelPrint function.
Code:
DECLARE INTEGER CreateDC IN WIN32API ;
  INTEGER lpszDriver, ;
  STRING @ lpszDevice, ;
  INTEGER lpszOutput, ;
  INTEGER lpInitData
DECLARE INTEGER DeleteDC IN WIN32API INTEGER hDC
[/li]

[li]Next, select the printer to send the data to. In the click event of a command button on your form, put:
Code:
Local lcPrinter
lcPrinter = GETPRINTER()
nHDC = CreateDC(0,lcPrinter,0,0)  && Get the printer handle
thisform.RTFControl1.SelPrint(nHDC)
=DeleteDC(nHDC)
[/li][/ol]

[sub]This code was adapted from an example from Ed Raugh[/sub]

Mike Gagnon

Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top