08-17-2005 01:13 PM
08-17-2005 01:24 PM
This function opens a document in its default viewer. This function has the same effect as double-clicking on a document in Windows Explorer.
You can register file types and their default viewers in Windows Explorer by selecting the File Types tab in the Folder Options dialog.
/*-------------------- Prototype ---------------------*/
int OpenDocumentInDefaultViewer (const char Document_Filename[],
int Window_Display);
08-17-2005 02:05 PM
08-17-2005 03:35 PM
08-17-2005 10:39 PM
08-18-2005 12:59 PM
Wendy,
I get an "undeclared identifier" compile error when I use Word_OpenDocument. What #include am I missing? I tried the "OpenDocumentInDefaultViewer method and it worked fine with one exception. It pops up a message about whether I want to save or discard changes (changes weren't made I just scrolled) when I close the viewer. I tried it both using .doc and .pdf formats. So do you know if the Word_OpenDocument method will make it so that this popup will not occur? I have the file as read-only so that doesn't help.
Thanks,
Donna
08-18-2005 03:01 PM
03-02-2006 06:59 PM
03-03-2006 03:49 AM
Hi Donna
There is another solution, you can use:
system("winword.exe E:\\file.doc");
First is the name of the application you want to run it with, microsoft word in this case, and second the path of the file you want to open. There is also the LaunchExectuable(); the difference between them is that the first one doesn't return the control to your application until you close the document you have opened, with the second one you can still control your application while the word document is opened.
Juan