锘?!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
*淇敼榛樿嫻忚鍣?/strong>
*/
//嫻忚鍣ㄨ礬寰?
string exePath = @"F:\firefox\firefox.exe";
//娉ㄥ唽琛ㄩ」
string reg = @"http\shell\open\command";
string nameReg = @"http\shell\open\ddeexec\Application";
RegistryKey key = null;
try
{
key = Registry.ClassesRoot.OpenSubKey(reg, true);
if (key != null)
{
key.SetValue("", string.Format("\"{0}\" -- \"%1\"", exePath));
key.Close();
key = Registry.ClassesRoot.OpenSubKey(nameReg, true);
if (key != null)
{
key.SetValue("", Path.GetFileNameWithoutExtension(exePath));
key.Close();
}
}
}
catch (Exception)
{
key.Close();
}