悬赏园豆:40
[已关闭问题]
关闭于 2009-05-23 08:56
<table style="height: 100%;" border="0" cellspacing="0">
<tbody>
<tr>
<td id="Topic_Body" class="content">这是add.reg文件的类容 <br /><br />Windows Registry Editor Version 5.00 <br /><br />[HKEY_CLASSES_ROOT\Directory\shell\q_Cmd_Here\command] <br />@="cmd.exe /k cd %1" <br /><br />[HKEY_CLASSES_ROOT\*\shell\q_Cmd_Here\command] <br />@="cmd.exe" <br /><br />[HKEY_CLASSES_ROOT\Drive\shell\q_Cmd_Here\command] <br />@="cmd.exe /k cd %1" <br /><br /><br />这是添加到鼠标右键的FrmSetLeftKey.cs窗体button1添加,button2移除 <br /> private void button1_Click(object sender, EventArgs e) <br /> { <br /> try <br /> { <br /><br /> RegistryKey reg; <br /> reg = Registry.ClassesRoot; <br /><br /> reg = Registry.ClassesRoot; <br /> reg.CreateSubKey(@"*\shell\删除图片\command"); <br /> //创建新项command <br /> reg = Registry.ClassesRoot.OpenSubKey(@"*\shell\删除图片\command", true); <br /> reg.SetValue("", Application.ExecutablePath + " %1"); <br /> //设置command的值 <br /> reg.Close(); <br /> MessageBox.Show("添加成功!"); <br /> } <br /> catch (Exception ex) <br /> { <br /> MessageBox.Show(ex.ToString()); <br /> <br /> <br /> } <br /> } <br /><br /> private void button2_Click(object sender, EventArgs e) <br /> { <br /> try <br /> { <br /> RegistryKey reg; <br /> reg = Registry.ClassesRoot; <br /><br /> reg = Registry.ClassesRoot; <br /> reg.DeleteSubKey(@"*\shell\删除图片\command",false); <br /><br /> reg.Close(); <br /> MessageBox.Show("移除成功!"); <br /> } <br /> catch(Exception ex) <br /> { <br /> MessageBox.Show(ex.ToString()); <br /> <br /> } <br /> } <br /><br /><br />问题一: 我怎样添加我自己的一个form作为右键弹出的对象(应该是这一句:reg.SetValue("", Application.ExecutablePath + " %1");但看不懂) <br /><br />问题二FrmSetLeftKey.cs窗体的button2移除右键不会移除右键请csdn上朋友修改下。 </td>
</tr>
<tr>
<td class="modify"> </td>
</tr>
</tbody>
</table>