读书人

C# 启动 非 exe 程序解决思路

发布时间: 2012-01-08 22:48:50 作者: rapoo

C# 启动 非 exe 程序
如何用 C# 启动一个 TMP 或者其他后缀名的程序呢?

[解决办法]
Invoke API CreateProcess
只要是exe文件 不管后缀名是什么都ok
[解决办法]
using System.Runtime.InteropServices;

[DllImport( "kernel32.dll ")]
internal static extern uint WinExec(string lpCmdLine, uint uCmdShow);
private const uint SW_SHOW = 5;

private void button1_Click(object sender, EventArgs e)
{
WinExec(@ "c:\temp\temp.tmp ", SW_SHOW);
}

读书人网 >C#

热点推荐