gpt4 book ai didi

c++ - CreateProcess 的第二个参数应该是什么?

转载 作者:行者123 更新时间:2023-11-30 02:05:40 28 4
gpt4 key购买 nike

我正在尝试使用 CreateProcess() 启动服务器。这是代码:

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
// TODO: Place code here.

int result;
STARTUPINFO si;
PROCESS_INFORMATION pi;
CreateProcess("C:\\AP\\DatabaseBase\\dbntsrv.exe", "*** WHAT SHOULD I PUT HERE***", NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
return 0;
}

我没有从文档中理解第二个参数应该是什么。你能帮我吗?谢谢你

最佳答案

来自 MSDN:

lpCommandLine [in, out, optional]

The command line to be executed. The maximum length of this string is 32,768 characters, including the Unicode terminating null character. If lpApplicationName is NULL, the module name portion of lpCommandLine is limited to MAX_PATH characters.

The Unicode version of this function, CreateProcessW, can modify the contents of this string. Therefore, this parameter cannot be a pointer to read-only memory (such as a const variable or a literal string). If this parameter is a constant string, the function may cause an access violation.

The lpCommandLine parameter can be NULL. In that case, the function uses the string pointed to by lpApplicationName as the command line.

所以 NULL 至少在那里是可以的。只要您不传递参数。

关于c++ - CreateProcess 的第二个参数应该是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9427008/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com