C # launches an external program (1)-winexec

Source: Internet
Author: User

C # launches an external program (1)-winexec calls the Win32 API.
1.using system.runtime.interopservices;2.
//
#define SW_HIDE 0//Hide window, active state to make a window
#define SW_SHOWNORMAL 1//Display a window with its original size and position, and make it active
#define SW_NORMAL 1
#define Sw_showminimized 2
#define Sw_showmaximized 3
#define SW_MAXIMIZE 3
#define SW_SHOWNOACTIVATE 4//Display a window with the nearest size and position without changing the active window
#define SW_SHOW 5//displays a window with the current size and position, and makes it active
#define SW_MINIMIZE 6//Minimized window, active state to make a window
#define SW_SHOWMINNOACTIVE 7//Minimize a window without changing the active window
#define SW_SHOWNA 8//displays a window with the current size and position without changing the active window
#define Sw_restore 9//Same as Sw_shownormal 1
#define Sw_showdefault 10
#define Sw_forceminimize 11
#define SW_MAX 11
[DllImport ("kernel32.dll")]
public static extern int WinExec (string exename, int opertype); 3.
WinExec (@ "C:\WINDOWS\system32\cmd.exe", 5);

C # launches an external program (1)-winexec

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.