We help IT Professionals succeed at work.

Printing a text file with a MFC application

scs1
scs1 asked
on
Medium Priority
571 Views
Last Modified: 2013-11-20
I have a MFC application that when the user selects the menu item <PRINT REPORT> it writes a lot of formatted text to a text file. I want the program to then send the file to the default printer to be printed.  How do I do that?

I realize this is not the best way to a print a file with a MFC application.  However, I already have the text file formatted and would like to simply print that text file.
Comment
Watch Question

Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thank you very much for your help. However, I do not know how to set the windows handler (hWnd) to the notepad.  When I run the program with the line above it tries to print, but an error box pops up saying that the notepad handler is invalid.  How do I set it?

Author

Commented:
Forget the previous comment.  My problem was related to a printer setup problem with my computer.  I have corrected the problem and everything works great.  Thank you very much.
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.