怎样修改注册表,才能在所有文件的右键中添加一项,然后点击这一项后,打开指定程序并传入参数?

解决方案 »

  1.   


    string FileExt;
    string FileType;
    string MIMEType;
    string ExecName;FileExt=".test";
    FileType="Test File";
    MIMEType="text/plain";
    ExecName=Application.ExecutablePath +" %1";RegistryKey RegKey;
    RegKey=Registry.ClassesRoot;
    RegKey=RegKey.CreateSubKey(FileExt);
    //RegKey.OpenSubKey(FileExt, true);
    RegKey.SetValue("", FileType);
    RegKey.SetValue("Content Type", MIMEType);
    RegKey=RegKey.CreateSubKey("shell\\open\\command");
    RegKey.SetValue("", ExecName);
    RegKey.Close();
    这个是将扩展名为.test的文件关联到本应用程序。
      

  2.   

    c#提供了一个类
    RegistryKey