欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C# winform 启动外部程序

程序员文章站 2022-03-06 21:39:40
//class里面放入这段代码[DllImport("shell32.dll")]public static extern int ShellExecute(IntPtr hwnd, StringBuilder lpszOp, StringBuilder lpszFile, StringBuilde ......

//class里面放入这段代码
[dllimport("shell32.dll")]
public static extern int shellexecute(intptr hwnd, stringbuilder lpszop, stringbuilder lpszfile, stringbuilder lpszparams, stringbuilder lpszdir, int fsshowcmd);


//需要打开的地方插入此段代码


shellexecute(intptr.zero, new stringbuilder("open"), new stringbuilder("test.exe"), new stringbuilder(""), new stringbuilder(@"c:\文件夹名"), 1);