how can I print the text of a edit control and the selected text of a edit control ?
Edit control or richedit.
Can you please help?

Posted on 2002-03-09 04:04:03 by Nordwind64

Rich edit is the way to go as there are formatting and other capacities to send data to the default printer based on what the text "looks" like in the rich edit control.

I am sorry I don't have any example code for that, I have seen it in other languages but have never ported it myself.

Good luck.

Posted on 2002-03-10 03:13:46 by hutch--
This is what the platform SDK has to say about printing a richedit:

You can send messages to a rich edit control to render its output for a specified device, such as a printer. You can also specify the output device for which a rich edit control formats its text.

To format part of a rich edit control's contents for a specific device, you can use the EM_FORMATRANGE message. The FORMATRANGE structure used with this message specifies the range of text to format as well as the device context for the target device.

After formatting text for an output device, you can send the output to the device by using the EM_DISPLAYBAND message. By repeatedly using the EM_FORMATRANGE and EM_DISPLAYBAND messages, an application that prints the contents of a rich edit control can implement banding. (Banding is the division of output into smaller parts for printing purposes.)

You can use the EM_SETTARGETDEVICE message to specify the target device for which a rich edit control formats its text. This message is useful for WYSIWYG formatting, in which an application positions text using the default printer's font metrics instead of the screen's.

Posted on 2002-03-10 03:37:27 by Thomas

I'm writing my own printer function now via Escape() and TextOut(). That looks great and it's very flexible...

Thank you again.

Posted on 2002-03-10 04:00:05 by Nordwind64