Don’t Be So Hard On Yourself (or, ShellExecute() to the Rescue!)
I’ve got a bad habit of always trying to reinvent the wheel, even when I’ve got a perfectly good wheel right in front of me.
I just wrapped up some work on a Visual FoxPro app that uses a lot of rich-text format (RTF) files, and I was hitting a brick wall when it came to printing the documents.
Plus, if the user has word-processing software (Office, OpenOffice, etc.) and it’s properly registered as the handler for RTF files, it’ll have all the print functionality built-in, too.
So, instead of pulling out the remaining few hairs on my head, I decided to go theShellExecute route, and set the menu up to open the user’s default RTF application in two different ways:
- EDIT mode - (The Print menu item – the user can do what they want with the document, then select the printer, etc.)
- PRINT mode (The Quick Print menu item – open the app, and print the document to the default Windows printer)
So, I went from researching and trying all kinds of workarounds to this:
And immediately felt relieved for being just a little less hard on myself…
VERY HIGHLY RECOMMENDED!!!
More info on the CommandBars library: