public bool reg(bool isKillProcess) { try { if (textBox1.Text == "") { alert("请选择注册文件!"); return false; } else { RWReg rg = new RWReg("LOCAL_MACHINE"); if (rg.GetRegVal("Software\\SimpleSoft\\BhoDir", "SysPath", "ref_null") == "ref_null") { rg.CreateRegKey("Software\\SimpleSoft\\BhoDir"); } rg.SetRegVal("Software\\SimpleSoft\\BhoDir", "SysPath", textBox1.Text); } if (isKillProcess) { DialogResult dg = MessageBox.Show("将要停止所有IE程序,确定执行吗?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question); if (dg.ToString().ToLower().Equals("yes")) { if (regster.doCommand("/codebase BHO_helloWorld.dll") && regster.killProcess("iexplore")) { //regster.startSysProcess("IEXPLORE"); return true; } } } return false; } catch (Exception e) { return false; throw e; } }
private void button2_Click(object sender, EventArgs e) { if (checkBox3.Checked) { RWReg rg = new RWReg("LOCAL_MACHINE"); if (rg.GetRegVal("Software\\SimpleSoft\\BhoDir", "SysPath", "ref_null") != "ref_null") { rg.DelRegSubKey("Software\\SimpleSoft\\BhoDir"); } } if (regster.doCommand("/codebase BHO_helloWorld.dll /unregister")) { alert("卸载成功"); } else { alert("卸载失败"); } }