I made this script to start a program:
No errors (Win XP, Borland), but when I execute the file, it couts:Code:#include <iostream.h>
#include <windows.h>
using namespace std;
struct exec
{
char path[];
char par[];
char dir[];
};
void execute (exec *x)
{
HINSTANCE hRet = ShellExecute(
HWND_DESKTOP, //Parent window
"open", //Operation to perform
x->path, //Path to program
x->par, //Parameters
x->dir, //Default directory
SW_SHOW); //How to open
if((LONG)hRet <= 32)
{
cout << "Wrong directory!!" << endl;
}
}
int main()
{
cout << "Starting firefox..." << endl;
exec pars = {"C:\\Program Files\\Mozilla Firefox\\firefox.exe", "", ""};
execute(&pars);
system("PAUSE");
return 0;
}
"Wrong directory!". What am I doing wrong??