According the documentation, To prints the document file, lpFile parameters must be a document file. If lpFile is not a document file, the function will fail.
The command will open & print the doc file using default association program
To open with Wordpad,
- specify lpFile with EXE file (Wordpad)
- specify lpParameters with fullpath & filename, or just the filename and specify fullpath in lpDirectory
Thank you for your reply,
I tried your first option to send my doc which is rtf doc directly to printer by calling "SW_HIDE" but it did not solve, anyway the file was loaded for several seconds right after sent to printer. I also tried your second option to load it but force it to be open by WordPad as you wrote, but it actually displaid the WordPad for editing without loading my rtf doc and never sent it to printer eventually.
The method worked. I'm not sure what you mean with "did not solve"
I tested with rtf file. It worked and printed using default association file (MS WORD). Yes, Word itself still opening for a few seconds (only for the first time, it is much faster after that). And then it close itself.
If you want you can try like this:
; *** Open MS Word, Hide the window
ShellExecute(0, NULL, "Winword", NULL, NULL, SW_HIDE)
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.