經過weburl 啓動windows程序

1. 註冊表修改shell

創建一個reg文件 執行導入  以RunLocal協議爲例子windows

Windows Registry Editor Version 5.00this

[HKEY_CLASSES_ROOT\RunLocal]
@="RunLocal Protocol"
"URL Protocol"=""orm

[HKEY_CLASSES_ROOT\RunLocal\DefaultIcon]
@="c:\\windows\\RunLocal.exe,1"string

[HKEY_CLASSES_ROOT\RunLocal\shell]
@=""it

[HKEY_CLASSES_ROOT\RunLocal\shell\open]
@=""io

[HKEY_CLASSES_ROOT\RunLocal\shell\open\command]
@="\"c:\\windows\\RunLocal.exe\" \"%1\""class

 

2. 創建windows程序object

Program.cs 文件修改程序

static void Main(string[] args)
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
if (args.Length == 0)
{
Application.Run(new Form2());
}
else
{
Application.Run(new Form2(args));
}
}

 

窗體文件程序

public partial class Form2 : Form
{
string[] args = null;
public Form2()
{
InitializeComponent();
}
public Form2(string[] args)
{
InitializeComponent();
this.args = args;
}
private void Form2_Load(object sender, EventArgs e)
{
if (args != null)
{
this.label1.Text = args[0];

} } }

相關文章
相關標籤/搜索