为什么我的CreateProcess(一个外部的exe)会不行啊?GetLastError()返回是2
btw:2是什么意思?哪里能查到?

解决方案 »

  1.   

    The system cannot find the file specified. 
    check the path of exe file
      

  2.   

    理论上,CreateProcess可以用于任何地方,只是合理不合理的问题。
    检查每个参数,确保其正确。
      

  3.   

    难道notepad他都找不到? m_thread_created = CreateProcess(
    #ifdef _DEBUG
     _T("notepad.exe"),
      
           
    #else
       
      _T("notepad.exe"),
           
       
    #endif
    buffer,       // command line 
    NULL,          // process security attributes 
    NULL,          // primary thread security attributes 
    TRUE,          // handles are inherited 
        0,
    NULL,          // use parent's environment 
    NULL,          // use parent's current directory 
    &m_siStartInfo,  // STARTUPINFO pointer 
    &m_piProcInfo);  // receives PROCESS_INFORMATION 
       if (m_thread_created == FALSE) {
       char buffer[512];
       sprintf(buffer, "Thread error is %d", GetLastError());
       AfxMessageBox(buffer);
       }
      

  4.   

    胖子: 什么不行?我的代码不行?还是ocx里面不能用createprocess?
      

  5.   

    明白了。。我的buffer值设置错了
      

  6.   

    不对,不关buffer的事,buffer换成 NULL,还是不行
      

  7.   

    memset( &startup, 0, sizeof( startup ) );// STARTUPINFO pointer 
    startup.cb = sizeof( startup );
    startup.wShowWindow = SW_SHOWNORMAL; memset( &process, 0, sizeof( process ) );receives PROCESS_INFORMATION