您的位置:首页 > 其它

在系统的右键菜单中添加选项

2006-05-17 23:28 399 查看
using System;
using Microsoft.Win32;
using System.Diagnostics;

namespace 在系统菜单中添加命令
{
/// <summary>
/// Class1 的摘要说明。
/// </summary>
class Class1
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main(string[] args)
{
//
// TODO: 在此处添加代码以启动应用程序
//
if(args.Length>0)
{
Console.WriteLine(args[0]);
Console.Read();
}
else
{
Process p=Process.GetCurrentProcess();
RegistryKey RegKey;
RegKey=Registry.ClassesRoot;
RegKey=RegKey.CreateSubKey("*//shell//MyApp");
RegKey.SetValue("","What is this?");
RegKey=Registry.ClassesRoot;
RegKey=RegKey.CreateSubKey("*//shell//MyApp//command");
RegKey.SetValue("",p.MainWindowTitle+"%1");
RegKey.Close();
}
}
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: