title: how to use the CreateProcess function in Visual Studios
body: <p>I've seen some examples of the CreateProcess() function on Stack Overflow, but I could not get the examples to work.  I'm using Visual Studio but programming the straight C.  Here is my latest attempt.  I can get it to compile and execute, but I can't get it to start the application:</p>
  
  <pre><code>PROCESS_INFORMATION ProcessInfo; //This is what we get as an [out] parameter
  STARTUPINFO StartupInfo; //This is an [in] parameter
  ZeroMemory(&amp;StartupInfo, sizeof(StartupInfo));
  
  StartupInfo.cb = sizeof StartupInfo ; 
  
  hr = CreateProcess((NULL, (LPTSTR) "C:\\Windows\\System32\\notepad.exe"), NULL,  
                      NULL,NULL,FALSE,0,NULL,
                      NULL,&amp;StartupInfo,&amp;ProcessInfo);
  
                  int error_1 = 0;
                  if(!hr)
                  {
                      error_1 = GetLastError();
                  }
  </code></pre>
  
  <p>When I read 'error_1', it returns a '2', which based upon the System Error Codes indicates that "The system cannot find the file specified.".  However, I'm sure the path is correct as I can use the path from the command line to start "Notepad".  I can't see what I'm doing wrong.</p>