CreateProcess() lpCurrentDirectory has no effect
CreateProcess() lpCurrentDirectory has no effect
我想启动一个进程(exe文件),如果我将完整路径附加到我的命令行(lpCommandLine参数)一切都很好,但如果我将lpCurrentDirectory设置为[STARTDIR]系统说:
ERROR_FILE_NOT_FOUND
启动进程:
CreateProcessA(NULL, // No module name (use command line)
&command[0], // Command line
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
FALSE, // Set handle inheritance to FALSE
CREATE_NEW_CONSOLE, // No creation flags
NULL, // Use parent's environment block
[NULL] or [STARTDIR], // Use parent's starting directory
startupInfo, // Pointer to STARTUPINFO structure
processInfo) // Pointer to PROCESS_INFORMATION structure
->在这个文件夹中有一些其他的dll和我想要启动的exe
为什么这不起作用?
谢谢!
不行,不行。在启动过程中,新进程不会以该目录作为"当前"目录启动。相反,一旦进程启动,就会设置当前目录。
如果您希望您的进程在一个特定的目录中启动,那么您需要使用SetCurrentDirectory
或其中一个或多或少可移植的变体(例如_chdir
)。
相关文章:
- "error: no matching function for call to"构造函数错误
- 调用专用模板时出错"no matching function for call to [...]"
- c++20[[no.unique_address]]中的新功能是什么
- 以线程安全的方式调用"QQuickPaintedItem::updateImage(const QImage&image)"(no QThread)
- "no matching function for call to 'Vector::Vector'"错误
- Android NDK clang 编译器错误在 Windows 上显示'No such file or directory'
- 处理"no operator found"
- 我在 ifstream input_file(文件名)行中收到错误"no matching function to call";
- 如何解决"no Qt platform plugin could be initialized"问题?
- "Unable to start debugging. No process is associated with this object." - 在Visual Studio Code中使用GDB
- 为什么当我在 std::string 中打开文件名的 fstream 时出现"no matching function"错误?
- 已解决 - C++ 的崇高文本中的"fatal error: opencv: no such file or directory"
- do while 循环中的 if 语句以 yes 或 no 结尾
- 从 TVector2 类派生复杂类:"No matching function for call to Complex::Complex()"
- 如何在过载时强制"statement has no effect"警告==
- cmake source_group has no effect
- std::basic_fstream::put() has no effect
- 循环C++"Statement has no effect"警告?
- C++ My string Has No Effect
- CreateProcess() lpCurrentDirectory has no effect