• <small id='kW4ny'></small><noframes id='kW4ny'>

  • <legend id='kW4ny'><style id='kW4ny'><dir id='kW4ny'><q id='kW4ny'></q></dir></style></legend>
  • <i id='kW4ny'><tr id='kW4ny'><dt id='kW4ny'><q id='kW4ny'><span id='kW4ny'><b id='kW4ny'><form id='kW4ny'><ins id='kW4ny'></ins><ul id='kW4ny'></ul><sub id='kW4ny'></sub></form><legend id='kW4ny'></legend><bdo id='kW4ny'><pre id='kW4ny'><center id='kW4ny'></center></pre></bdo></b><th id='kW4ny'></th></span></q></dt></tr></i><div id='kW4ny'><tfoot id='kW4ny'></tfoot><dl id='kW4ny'><fieldset id='kW4ny'></fieldset></dl></div>

          <bdo id='kW4ny'></bdo><ul id='kW4ny'></ul>
        <tfoot id='kW4ny'></tfoot>

        CreateProcess 不传递命令行参数

        时间:2023-08-01
        <tfoot id='DlhMx'></tfoot>

        <small id='DlhMx'></small><noframes id='DlhMx'>

          <tbody id='DlhMx'></tbody>

            1. <i id='DlhMx'><tr id='DlhMx'><dt id='DlhMx'><q id='DlhMx'><span id='DlhMx'><b id='DlhMx'><form id='DlhMx'><ins id='DlhMx'></ins><ul id='DlhMx'></ul><sub id='DlhMx'></sub></form><legend id='DlhMx'></legend><bdo id='DlhMx'><pre id='DlhMx'><center id='DlhMx'></center></pre></bdo></b><th id='DlhMx'></th></span></q></dt></tr></i><div id='DlhMx'><tfoot id='DlhMx'></tfoot><dl id='DlhMx'><fieldset id='DlhMx'></fieldset></dl></div>
                <legend id='DlhMx'><style id='DlhMx'><dir id='DlhMx'><q id='DlhMx'></q></dir></style></legend>

                  <bdo id='DlhMx'></bdo><ul id='DlhMx'></ul>
                • 本文介绍了CreateProcess 不传递命令行参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  您好,我有以下代码,但没有按预期工作,无法弄清楚问题出在哪里.

                  Hello I have the following code but it isn't working as expected, can't figure out what the problem is.

                  基本上,我正在执行一个进程(一个 .NET 进程)并传递命令行参数,它由 CreateProcess() 成功执行,但 CreateProcess() 没有传递命令行参数

                  Basically, I'm executing a process (a .NET process) and passing it command line arguments, it is executed successfully by CreateProcess() but CreateProcess() isn't passing the command line arguments

                  我在这里做错了什么??

                  What am I doing wrong here??

                  int main(int argc, char* argv[])
                  {
                      PROCESS_INFORMATION ProcessInfo; //This is what we get as an [out] parameter
                  
                      STARTUPINFO StartupInfo; //This is an [in] parameter
                  
                      ZeroMemory(&StartupInfo, sizeof(StartupInfo));
                      StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
                  
                      LPTSTR cmdArgs = "name@example.com";
                  
                      if(CreateProcess("D:\email\smtp.exe", cmdArgs, 
                          NULL,NULL,FALSE,0,NULL,
                          NULL,&StartupInfo,&ProcessInfo))
                      { 
                          WaitForSingleObject(ProcessInfo.hProcess,INFINITE);
                          CloseHandle(ProcessInfo.hThread);
                          CloseHandle(ProcessInfo.hProcess);
                  
                          printf("Yohoo!");
                      }  
                      else
                      {
                          printf("The process could not be started...");
                      }
                  
                      return 0;
                  }
                  

                  嘿还有一件事,如果我像这样传递我的 cmdArgs :

                  Hey one more thing, if I pass my cmdArgs like this:

                  // a space as the first character
                  LPTSTR cmdArgs = " name@example.com";
                  

                  然后我得到错误,然后 CreateProcess 返回 TRUE 但我的目标进程没有执行.

                  Then I get the error, then CreateProcess returns TRUE but my target process isn't executed.

                  Object reference not set to an instance of an object
                  

                  推荐答案

                  你应该在参数中指定模块名称:LPTSTR cmdArgs = "App name@example.com";它应该是整个命令行(包括 argv[0]).

                  You should specify also the module name in parameters: LPTSTR cmdArgs = "App name@example.com"; It should be the whole command line (including argv[0]).

                  这篇关于CreateProcess 不传递命令行参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  <i id='JPjVG'><tr id='JPjVG'><dt id='JPjVG'><q id='JPjVG'><span id='JPjVG'><b id='JPjVG'><form id='JPjVG'><ins id='JPjVG'></ins><ul id='JPjVG'></ul><sub id='JPjVG'></sub></form><legend id='JPjVG'></legend><bdo id='JPjVG'><pre id='JPjVG'><center id='JPjVG'></center></pre></bdo></b><th id='JPjVG'></th></span></q></dt></tr></i><div id='JPjVG'><tfoot id='JPjVG'></tfoot><dl id='JPjVG'><fieldset id='JPjVG'></fieldset></dl></div>
                    <bdo id='JPjVG'></bdo><ul id='JPjVG'></ul>
                  • <tfoot id='JPjVG'></tfoot>

                          <tbody id='JPjVG'></tbody>
                          <legend id='JPjVG'><style id='JPjVG'><dir id='JPjVG'><q id='JPjVG'></q></dir></style></legend>
                        1. <small id='JPjVG'></small><noframes id='JPjVG'>