When you write a program, you often use it to invoke executable programs, and this article briefly describes how C # calls EXE. In C #, process operations are performed through the processes class. The process class is in the System.Diagnostics package.
Example One
Using= Process.Start ("notepad.exe");p. WaitForExit (); // Critical, wait for external programs to exit before executing
You can call the Notepad program with the above code, and note that if you do not call the system program, you need to enter the full path.
Example Two
When the CMD program needs to be called, the annoying black window pops up with the call method above. If you want to eliminate it, you need to make more detailed settings.
The StartInfo property of the Process class contains some of the processing initiation information, some of which are more important
FileName Executable file name
Arguments program parameters, entered as strings
CreateNoWindow If you don't need to create a window
UseShellExecute If a system shell is required to invoke the program
With the above parameters, you can make the annoying black screen disappear.
New=truefalse; Exep. Start (); Exep. WaitForExit (); // Critical, wait for external programs to exit before executing
Or
Newnew= =truefalse; Exep. Start (startinfo); Exep. WaitForExit (); // Critical, wait for external programs to exit before executing
C # calling EXE program example