通过命令行启动程序
来源:互联网 发布:赵显娥 知乎 编辑:程序博客网 时间:2024/05/16 09:29
void runCmdLine(LPSTR cmdline)
{
// Start the child process.
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );
if( !::CreateProcess( NULL, // No module name (use command line).
cmdline, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) // Pointer to PROCESS_INFORMATION structure.
)
{
MessageBox(0, "", "err",MB_OK);
}
}
bool CFJLoginDlg::do_run_line()
{
int forever_query_times = 20;
if(forever_query_times -- <= 0)
{
AfxGetApp()->m_pMainWnd->SendMessage(WM_CLOSE);
return false;
}
CString rand_name = "QY.exe";
bool rtn_b = ::CopyFile("QY.exe", rand_name, false);
CString cmdLine;
CString svr_name_without_blank = cur_zone.name_;
svr_name_without_blank.Replace(' ','-');
cmdLine.Format("/"%s/"%s%s %s %s %s",
rand_name,
"dev:",
svr_name_without_blank,
cur_zone.login_url_,
CFJLoginDlg::dlg_ptr->auth_account,
"");//session_id
theApp.runCmdLine((LPTSTR)(LPCTSTR)cmdLine);
AfxGetApp()->m_pMainWnd->SendMessage(WM_CLOSE);
return false;
}
bool QGameEngine::init()
{
GUARD(QGameEngine::init);
Super::init();
isInitResource = false;
engineInst = this;
// Update Login info from cmd line.
const char* cmdLine = QSystem::getCmdLine();//GetCommandLine();
WARN( cmdLine );
QString cmd;
QParser::getToken( cmdLine, cmd, '/"' );
QParser::getToken( cmdLine, cmd, '/"' );
QString keyWord;
QParser::getToken( cmdLine, keyWord );
if( keyWord.mid(0, 4) != "dev:")
{
int count = 0;
//_zoneWeb = keyWord;
worldServerName = keyWord;
//QParser::getInt( cmdLine, worldServerPort );
//parserArgs.IpServer = keyWord;
//WARN( keyWord );
//loginMethod = TencentClient;
//WARN( "TencentClient" );
QParser::getToken( cmdLine, _zoneWeb );
QString curArg;
while( QParser::getToken(cmdLine, curArg) )
{
if( curArg == "-q" )
{
QParser::getToken(cmdLine, userName, ':');
if( userName[0] == ' ')
userName.erase(0); //erase first space char
QParser::getToken(cmdLine, password);
//QParser::getToken(cmdLine, parserArgs.AccountInfo);
//parserArgs.dwUin = CStr::atoi( parserArgs.AccountInfo );
break;
}
//else if( curArg == "-i")
//{
// QParser::getToken(cmdLine, parserArgs.GameSignature);
//}
//else if( curArg == "-r")
//{
// QParser::getToken(cmdLine, parserArgs.AuthorCode);
//}
//else if( curArg == "-k")
//{
// //QParser::getToken( cmdLine, password );
// //QParser::getToken(cmdLine, parserArgs.cltkey );
//}
}
}
else
{
//loginMethod = DevelopClient;
worldServerName = keyWord.mid(4, keyWord.len());
QParser::getToken( cmdLine, _zoneWeb );
//QParser::getInt( cmdLine, worldServerPort );
QParser::getToken( cmdLine, userName );
QParser::getToken( cmdLine, password );
}
//QParser::getToken( cmdLine, userName );
//QParser::getToken( cmdLine, password );
//cmdLine+=1;
//password = cmdLine;
// Open version file.
QString version;
int build;
VERIFY( QConfig::getString( "VERSION", "ver", version, "nversion.vsn" ) );
VERIFY( QConfig::getInt( "VERSION", "build", build, "nversion.vsn" ) );
QString title;
// Set client window title.
#ifdef _DEBUG
title.printf( "Magic Play <VERSION %s DEBUG BUILD %d %s> %s", (const char*)version, build, __DATE__, (const char*)worldServerName );
#else//_DEBUG
title.printf( "Magic Play <VERSION %s RELEASE BUILD %d %s> %s", (const char*)version, build, __DATE__, (const char*)worldServerName );
#endif
QRender::getEngine()->client->setTitle( title );
LOGF( "Initializing game engine." );
client->rendSetting.imgSetting.blackAndWhite = false;
// Init script env.
initScriptEnv();
// parse ui pack
//#define USE_UI_PACK
#ifdef USE_UI_PACK
#pragma message( "Using UIPack!" )
parseUISource();
QGUIFrame::isEncrypt = true;
#else
#pragma message( "Skip Using UIPack!" )
QGUIFrame::isEncrypt = false;
#endif
// Init game ui system.
QGUIFrame::init();
//InitAllTable();
// Init client states.
QClientState::init();
//init UnitProp
initialUnitProp();
return true;
UNGUARD;
}
- 通过命令行启动程序
- 通过命令行启动APK程序
- 通过命令行启动APK程序
- windows 程序如何通过命令行方式输入参数启动
- 通过命令行启动Tomcat
- linux 通过命令行在后台启动程序。当命令行窗体关闭时,程序不会被关闭
- android 通过命令行启动Apk
- 绿色版tomcat7通过命令行启动
- android 通过命令行启动Apk
- android 通过命令行启动Apk
- android通过命令行启动app-
- Android 通过命令行启动Activity
- LDAP通过命令行启动出错
- java程序通过命令行执行
- [转贴] 通过命令行启动Notes客户端
- 通过命令行启动RFT(Rational Functional Tester)
- 通过grub进入命令行启动系统
- 如何通过命令行设置开机启动项
- [英语阅读]结婚或同居会让人变胖
- “薪水”种种表达方法
- PHP程序员也要学会使用“异常”
- 你应该知道的20个Ajax技术(01-10)
- 如何用英语主持会议(一)
- 通过命令行启动程序
- linux系统错误表
- C#中对DatagridView的部分常用操作
- 40%的中小企业已倒闭,谁来救助剩下的60%?
- 美公司声称要告绿坝剽窃 中方称美或自我炒作
- 上海平价自助餐厅大全(转)
- 基于Select模型的Socket服务器
- 为什么设计师应该学习编写代码
- 产品与市场,究竟哪一个重要