-
April 5th, 2009, 03:23 PM
#1
printing a text file
I need to print a text file automatically with the default printer (I mean print on paper, not print to the screen). I've found a bunch of disorganized information everywhere about how to do this, but none of it really helps. I was wondering if someone could give me an example function for printing "example.txt".
If anybody knows any tutorials, it would also be nice to hear about them.
Thanks!
-
April 5th, 2009, 04:04 PM
#2
Re: printing a text file
I'm not in my office at the moment, however there is a way to get notepad to print a file directly without displaying it.
Code:
char* pFileName = "c:\\temp.txt";
ShellExecute(this->m_hWnd,"open","Notepad.exe", pFileName, "c:\\", SW_SHOW);
I do the above in my apps.
Look up the in the internet how to get Notepad.exe to print a file in the background, I think there is a way to do that.
If not when I get back to my office I'll post some code to open up the print engine and print a text file.
Rate this post if it helped you.
-
April 6th, 2009, 01:00 AM
#3
Re: printing a text file
Well, that should only open the file. But if you used "print" instead of "open" for the second argument to ShellExecute(), then that should print the file.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|