Originally Posted by
muffinman8641
Oh goodness, I'm so confused.
ShellExecute didn't work, unless I did something wrong with it (included <shellapi.h> and put my root stuff into the correct quotes).
I'm surprised there isn't some little statement that opens it (like ShellExecute or something). do I use it?
muffinman,
when people here give you advise, they might not always give you the absolute full details.
That's so that you can learn by researching the problem.
The example Tater gave you does work, as shown.
What he did not state, and you could have researched in the SDK or MSDN, was that ShellExecute requires that you link to the shell32.lib library.
This code works:
Code:
#include <stdio.h>
#include <windows.h>
#include <shellapi.h>
int main()
{
ShellExecute(NULL,"Open", "C:\\windows\\notepad.exe",NULL,NULL,SW_SHOWNORMAL);
return 0;
}
** in your IDE, add to your linker options: shell32.lib
The above illustrates a console mode app., however, the code works in a gui app. as well.
-edit-
muffinman,
If you are going to be programming windows, there are two things you need:
1) a bookmark to MSDN: http://msdn.microsoft.com/en-us/default.aspx
2) a download copy of the SDK.