Command Line obtained by the sub-process created with CreateProcessParametersThere are several situations:
1. The third winmain function in the sub-processParametersCommand Line in the left-side Navigation PaneParametersRemove the Application Path, file name, andParametersSeparated by spaces and other strings. For example
Parent process:
CreateProcess (null, "C: // test.exe-P", null, null, false, 0, null, null, & Si, & PI );
In the sub-processParameters-P. Note that no double quotation marks exist.
2. IfParametersView command linesParametersWhen the parent process creates a child processParametersAdd a space number. For example:
Parent process:
CreateProcess ("C: // test.exe", "-P", null, null, false, 0, null, null, & Si, & PI );
In the sub-processParameters-P, no space.
3. If you want to obtain the complete command line of the sub-processParameters, Call the getcommandline function. The command line usually obtained through the getcommandline FunctionParametersIs complete when the parent process is called.Parameters.
CreateProcess (null, "C: // test.exe-P", null, null, false, 0, null, null, & Si, & PI );
In the child process, getcommandline returnsParametersC: // test.exe-P. Note that no double quotation marks exist.
In the following cases, call the getcommandline function to obtain the command line.Parameters
4. The first CreateProcessParametersIs null, the secondParametersThe sub-application and command line.Parameters, Then the sub-process command lineParametersIs the secondParameters, Without double quotation marks. For example:
Parent process:
CreateProcess (null, "C: // test.exe-P", null, null, false, 0, null, null, & Si, & PI );
Command Line obtained by getcommandline in the sub-processParametersC: // test.exe-P
5. The first CreateProcessParametersSpecifies the path and file name of the sub-application, and the secondParametersIf it is null, the sub-process command lineParametersIs the firstParameters, With double quotation marks. For example:
Parent process:
CreateProcess ("C: // test.exe", null, false, 0, null, null, & Si, & PI );
Command Line obtained by getcommandline in the sub-processParametersFor "C: // test.exe"
6. The first CreateProcessParametersSpecifies the path and file name of the sub-application, and the secondParametersForParameters, Then the sub-process command lineParametersIs the secondParameters, Without double quotation marks. For example:
Parent process:
CreateProcess ("C: // test.exe", "-P", null, null, false, 0, null, null, & Si, & PI );
Command Line obtained by getcommandline in the sub-processParameters-P.
Note that the comparison is the same as the second one. If you use the lpcmdline command to view the command lineParametersNothing. Change "-P" to "-P ".ParametersYes-P, isn't it confusing?
Http://support.microsoft.com/kb/175986
CreateProcess () action when creating a 32-bit Process
CreateProcess () does not force ANSI-compliant parameters to be passed to a 16-bit application. This will trigger the way CreateProcess works from an application to the next application and ask you to know that the application you generated is inconsistent between 16-bit or 32-bit executable files. confusions. To further complicate the problem, CreateProcess is implemented slightly differently in Windows 95 and Windows NT.
Windows NT behavior:
If the first "parameter" in the CommandLine is not exactly the same as the applicationname string, it will execute the application before replacing it. For example, if the applicationname and CommandLine parameters are as follows:
CreateProcess( "c://MyApp16.exe", "Param1 Param2 Param3", ...)
Secondary, the application can see that the command line parameters are as follows:
argv[0] == "c:/MyApp16.exe" argv[1] == "Param2" argv[2] == "Param3"
Windows 95 behavior:
If the first "parameter" in the CommandLine is not exactly the same as the applicationname string, CreateProcess will fail and the error file cannot be found. In this case, there is no reason to pass null as the parameter to be passed in Windows 95 if you want to execute the CreateProcess applicationname parameter in a 16-bit application.