winapi:CreateProcess 但隐藏进程的窗口?

问题描述:

我正在使用 CreateProcess 创建一个 cmd.exe 进程,该进程传递了一个参数,它执行并退出,这使得命令提示符在屏幕上闪烁.

I am using CreateProcess to create a cmd.exe process that is passed a parameter that it executes and quits, this makes command prompt flash up on the screen.

我试图通过将 STARTUPINFO struct wShowWindow 设置为 SW_HIDE 来避免这种情况,但此参数似乎影响调用窗口,而不是执行进程的窗口.

I tried to avoid this by setting STARTUPINFO struct wShowWindow to SW_HIDE but this parameter seems to affect the calling window, not the window for the process that gets executed.

无论如何,您可以使用 createprocess 来启动隐藏的程序吗?

Is there anyway that you can use createprocess to launch a program that is hidden from view?

另外,获取环境变量的正确 winapi 标准方法是什么?

Also what is the proper winapi standard way to get enviroment variables?

在 dwFlags 中设置 STARTF_USESHOWWINDOW

set the STARTF_USESHOWWINDOW in dwFlags

来自尖牙