如果我在一个程序(比如: d:\start.exe)中调用CreateProcess创建一个进程(比如: c:\a.exe)
但在d盘中有a.exe需要的dll文件,怎样才能让d:\start.exe成功调用c:\a.exe
就好像c:\a.exe是在d:\下的一样.请高手解释,
谢谢!!

解决方案 »

  1.   

    The CreateProcess function creates a new process and its primary thread. The new process executes the specified executable file. BOOL CreateProcess(
      LPCTSTR lpApplicationName,
                             // pointer to name of executable module
      LPTSTR lpCommandLine,  // pointer to command line string
      LPSECURITY_ATTRIBUTES lpProcessAttributes,  // process security attributes
      LPSECURITY_ATTRIBUTES lpThreadAttributes,   // thread security attributes
      BOOL bInheritHandles,  // handle inheritance flag
      DWORD dwCreationFlags, // creation flags
      LPVOID lpEnvironment,  // pointer to new environment block
      LPCTSTR lpCurrentDirectory,   // pointer to current directory name
      LPSTARTUPINFO lpStartupInfo,  // pointer to STARTUPINFO
      LPPROCESS_INFORMATION lpProcessInformation  // pointer to PROCESS_INFORMATION
    );
     
      

  2.   

    楼上的copy起来真爽,可惜不能直接解决问题注意这个参数:
    LPCTSTR lpCurrentDirectory,   // pointer to current directory name这个参数能设定新进程的运行路径,你可以设置这个参数让d:\start.exe成功调用c:\a.exe
    就好像c:\a.exe是在d:\下的一样.