Thx for replying! I did it like this:
Code:
#include <iostream.h>
#include <windows.h>
using namespace std;
struct exec
{
string path;
string par;
string dir;
};
void execute (exec *x)
{
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
x->path.c_str(), //Path to program
x->par.c_str(), //Parameters
x->dir.c_str(), //Default directory
SW_SHOW); //How to open
if((long)hRet <= 32)
{
cout << "Wrong directory!!" << endl;
}
}
int main()
{
cout << "Starting firefox..." << endl;
exec pars;
pars.path = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
execute(&pars);
system("PAUSE");
return 0;
}
It didn't accept
Code:
exec pars = {"C:\\Program Files\\Mozilla Firefox\\firefox.exe", "", ""};
so I changed it to
Code:
pars.path = "C:\\Program Files\\Mozilla Firefox\\firefox.exe";
Is there a better/faster way to do that?