(1) system ()
Function Name: System
Function: Issue a DOS command
Usage: int system (char *command);
Note: The system function has been included in the standard C library and can be directly invoked
return value
=-1: Error occurred
= 0: The call succeeded but no child processes appear
>0: ID of the child process that successfully exited
Sample:
System ("D:\\game.exe");
System ("Mmc.exe \" "C:\\windows\\system32\\gpedit.msc\");
(2) WinExec ()
Function Prototypes:
UINT WINAPI WinExec (
__in LPCSTR lpCmdLine,
__in UINT ucmdshow);
Parameter description:
lpCmdLine,//command path
Ucmdshow,//display mode, there are 11 kinds, you can check the MSDN ShowWindow function
return value:
Success, the return value is greater than 31
Returns 0 indicating a memory or resource overflow
Return Error_bad_format indicates that the EXE file is illegal or corrupted.
Returned error_file_not_found the specified file was not found.
Return Error_path_not_found cannot find the specified path
Sample Example:
WinExec ("Notepad.exe", sw_show); Open Notepad
WinExec ("D:\\Program files\\test\\test.exe", sw_showmaximized); Open Test.exe in a maximized manner (note that the file name must be the same case)