-
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!
-
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.
:)
-
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.