I want to write a program that allows me too write the path of a document and then open it. (also so that I can edit it.) I've tried a couple times, but i think the problem is is that i'm using a Win32 console application instead of something else. And if that is the problem, what one should I use?
OK... no one seems to be answering... Here is a program that I made. (There probably are some problems with it. Also, I have only done it for one document.)
#include <iostream>
#include <ShellAPI.h>
usingnamespace std;
int main()
{
cout << "Type the number and pres enter to open the following documents:";
cout << "\n 1 = nadding value";
int choice;
cin >> choice;
do
{
if (choice = 1)
{
ShellExecute(this->m_hWnd,"open",
"adding value.doc","C:\\Users\\Haziqu\\Documents\\School Work\\Business\\adding value.doc",SW_SHOW);
}
else
{
cout << "Please enter a valid number";
}
}while(choice != 1);
cin.get()
return 0;
}
At the moment, when I hover over 'ShellExecute' it says it is undefined.
Also when I hover over 'this' it says that this may only be used in a noon-static member function.
Lastly, when I hover over 'SW_SHOW' it says that this is not defined.
The program is supposed to keep looping until the user chooses '1' to open the program.
PLEASE ANSWER!
thank you.
EDIT: I just ran the program, and a load of errors just came up! Obviously I am doing something (or more likely) or a lot of things wrong.
This is all so confusing! I made a much simpler code... but it doesnt work. It just comes up with a blank console window. doesnt open the word document.
> doesnt open the word document.
¿how are you checking that?
As long as the file exists and you do have permission, it should open. perror() may help you