首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > VC/MFC >

请问.怎么让一个程序开启另外一个程序

2013-09-05 
请教.如何让一个程序开启另外一个程序?我根据别人的源码写了一个自己的魔兽显蓝内存外挂.我想让运行魔兽争

请教.如何让一个程序开启另外一个程序?
我根据别人的源码写了一个自己的魔兽显蓝内存外挂.
我想让运行魔兽争霸(war3.exe)之后运行我写的内存挂(lan.exe),从而方便开启.请问有什么办法.
[解决办法]
CreateProcess就行了。
给个例子:
PROCESS_INFORMATION piProcInfo; 
STARTUPINFO siStartInfo;

// Set up members of STARTUPINFO structure.
siStartInfo.cb = sizeof(STARTUPINFO); 
siStartInfo.lpReserved = NULL;
siStartInfo.lpReserved2 = NULL; 
siStartInfo.cbReserved2 = 0;
siStartInfo.lpDesktop = NULL; 
siStartInfo.dwFlags = 0;

// Create the child process.
CreateProcess(NULL,
strCmdLine,
NULL, // process security attributes
NULL, // primary thread security attributes
0, // handles are inherited
0, // creation flags
NULL, // use parent's environment
NULL, // use parent's current directory
&siStartInfo, // STARTUPINFO pointer
&piProcInfo); // receives PROCESS_INFORMATION

[解决办法]


PROCESS_INFORMATION pi; 
if (!CreateProcess(_T("iexplore.exe"), NULL, NULL, NULL, NULL, 
CREATE_NEW_CONSOLE, NULL, NULL, NULL, &pi)){
    MessageBox(_T("failure."));
}
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);

我在WinCE系统下,打开iexplore.exe。

热点排行