Tous les collages #14887 Brut Modifier

Anonymous

public text v1 · immuable
#14887 ·publié 2005-06-17 20:05 UTC
corps du collage affiché
void CNeLLauncherDlg::LaunchClient(const string &cookie, const string &addr)
{
	nlinfo("LaunchClient called");

	string rapp = ConfigFile.getVar("Application").asString(1);
	string dir = ConfigFile.getVar("Application").asString(2);

//	vector<string> vargs;
	const char *args[50];

//	vargs.push_back(cookie);
//	vargs.push_back(addr);

//	uint i;
	//args[0] = rapp.c_str();
/*
	for(i = 0; i < vargs.size(); i++)
	{
		args[i+1] = vargs[i].c_str();
	}
*/
	//args[1] = NULL;

	//args[0] = cookie;
	
	//args[1] = addr;

	args[0] = cookie.c_str();
	args[1] = addr.c_str();

	//MessageBox("", "Connecting...", MB_ICONEXCLAMATION);

	const char *SE_TRANSLATOR_IN_MAIN_MODULE = "NEL_SE_TRANS";
	TCHAR envBuf [2];
	if ( GetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, envBuf, 2 ) != 0)
	{
		SetEnvironmentVariable( SE_TRANSLATOR_IN_MAIN_MODULE, NULL );
	}

	if(!dir.empty())
		_chdir(dir.c_str());

	// execute, should better use CreateProcess()
	if(_execvp(rapp.c_str(), args) == -1)
	{
		MessageBox("Can't execute the game (error code 17)", "Error");
	}
	else
	{
		quit();
	}
}