在我的程序中使用CreateProcess函数创建了一个进程,但有时候会报如下错误:
ERROR_NO_SYSTEM_RESOURCES
1450
Insufficient system resources exist to complete the requested service.请问这个问题是因为我程序本身有问题还是,创建进程的外部exe程序有问题造成的?一般是什么原因?谢谢!
ERROR_NO_SYSTEM_RESOURCES
1450
Insufficient system resources exist to complete the requested service.请问这个问题是因为我程序本身有问题还是,创建进程的外部exe程序有问题造成的?一般是什么原因?谢谢!
解决方案 »
- 在vs环境下学习mfc,一个简单文字操作,报错“ error C2593: 'operator +=' is ambiguous”
- 在VC中如何通过opencv获取相机到相片的物距.
- vc++6.0运行问题
- 一个有关插入以CTreeView为基类的类问题
- 用GlobalAlloc就发生例外发生的时候,用HeapAlloc就可以成功分配一块内存..是不是堆占溢出.
- 哪里能下载《windows程序调试》(最好英文版)?
- 线程的TLS有什么作用
- 如何用IStream传递一个较大的文件? 如何Mashaling该stream?
- Oracle记录集指针的问题。。。
- 请问如何将CBitmap转化为bmp文件????
- CreateWindow创建的窗口中输出文字,如何刷新?
- 小弟很荣幸成为VC/MFC网络编程小版版主,为感谢广大兄弟姐妹和鹦鹉兄的支持,特此散分300。
看看CreateProcess的代码
PROCESS_INFORMATION ProcessInformation;
GetStartupInfo(&StartupInfo);
::CreateProcess(0,(char*)cmd.c_str(),0,0,0,0,0,0,&StartupInfo,&ProcessInformation);cmd此时为:d:\myapp.exe nodeup 172.16.1.1
命令串格式正确,上面是日志中打印出来的!
我主要不解的地方是:是我程序的资源紧张还是系统资源紧张造成,有可能是因为我的程序有资源泄露造成吗?
PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
si.dwFlags |= STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
ZeroMemory( &pi, sizeof( pi ) ); char file[ 300 ] = "Explorer.exe ";
strcat( file, dir );
if( !CreateProcess( NULL, // No module name (use command line).
file, // 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.
)
{
AfxMessageBox( "CreateProcess failed." );
}
STARTUPINFOA StartupInfo;
PROCESS_INFORMATION ProcessInformation;
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
char cmdLine[MAX_PATH];
strcpy(cmdLine, (char*)cmd.c_str());
::CreateProcess(0,cmdLine,0,0,0,0,0,0,&StartupInfo,&ProcessInformation);