下面是我的代码:PROCESS_INFORMATION ProcessInfo;
STARTUPINFO StartupInfo; //This is an [in] parameter
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
if(CreateProcess(NULL,//"c:\\snort-1.9.0\\src\\win32\\win32-prj\\snort___win32_stddb_flexresp_service_sfstats_release\\snort.exe",
"c:\\snort-1.9.0\\src\\win32\\win32-prj\\snort___win32_stddb_flexresp_service_sfstats_release\\snort.exe -A unsock -c c:\\snort-1.9.0\\etc\\snort.conf -i2",
NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,NULL,
NULL,&StartupInfo,&ProcessInfo))
{
WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
}
else
{
MessageBox("The process could not be started...");
}
但运行结果只是一闪,没有任何提示,请大虾指教
STARTUPINFO StartupInfo; //This is an [in] parameter
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
if(CreateProcess(NULL,//"c:\\snort-1.9.0\\src\\win32\\win32-prj\\snort___win32_stddb_flexresp_service_sfstats_release\\snort.exe",
"c:\\snort-1.9.0\\src\\win32\\win32-prj\\snort___win32_stddb_flexresp_service_sfstats_release\\snort.exe -A unsock -c c:\\snort-1.9.0\\etc\\snort.conf -i2",
NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS|CREATE_NEW_CONSOLE,NULL,
NULL,&StartupInfo,&ProcessInfo))
{
WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
}
else
{
MessageBox("The process could not be started...");
}
但运行结果只是一闪,没有任何提示,请大虾指教
我的这个程序如果在cmd下执行的时候会出现如连接成功,发送成功等提示信息,我的接受程序也会有连接成功并显示出接受到的数据
但用这个createprocess调用后,只是一闪而过,没有任何提示,而且我的接收程序也没有任何如连接成功等提示信息,就是说,根本就没和我的接收程序连接成功
http://expert.csdn.net/Expert/topic/1223/1223956.xml?temp=.9217951