When executing a program, you may encounter an EXE question about starting the software, or enable other EXE files, which has been used to execute some operations. The following are the two most common startup EXE files.
1. Call the system DLL to use the provided method.
Referenced DLL,
[DllImport("kernel32.dll")] public static extern int WinExec(string exeName, int operType);
Call, winexec (@ "path \ exe file name", parameter );
Opertype parameters are as follows:
0: Hide, And the taskbar does not minimize the icon 1: Display with the nearest size and position, activate 2: Minimize, activate 3: Maximize, activate 4: display with the latest size and position. Do not activate 5: The same as 16: The minimum, do not activate 7: The same as 38: The same as 39: The same 110: The same 1
2. The most common processstartinfo startup
Processstartinfo info = new processstartinfo (); info. filename = @ "path \ exe file name"; info. arguments = ""; info. windowstyle = processwindowstyle. minimized; process pro = process. start (Info); pro. waitforexit ();
3. Stop the started EXE process
Process [] allprogresse = system. diagnostics. process. getprocessesbyname ("EXE process name"); foreach (process closeprogress in allprogresse) {If (closeprogress. processname. equals ("EXE process name") {closeprogress. kill (); closeprogress. waitforexit (); break ;}}