- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
Microsoft.Win32.RegistryKey Fregistry =
Microsoft.Win32.Registry.LocalMachine.OpenSubKey("SOFTWARE")
.OpenSubKey("Microsoft").OpenSubKey("Windows").OpenSubKey("CurrentVersion")
.OpenSubKey("Installer").OpenSubKey("UserData")
.OpenSubKey("S-1-5-18").OpenSubKey("Products");
string []Names = Fregistry.GetSubKeyNames() ;
string uninstall = "";
string ApplicationName = "Adobe Reader 7.0.8";
for (int i = 0; i < Names.Length; i++)
{
Microsoft.Win32.RegistryKey FTemp = Fregistry.OpenSubKey(Names[i]).OpenSubKey("InstallProperties");
if (FTemp.GetValue("DisplayName").ToString() == ApplicationName)
{
object obj = FTemp.GetValue("UninstallString");
if (obj == null)
uninstall = "";
else
uninstall = obj.ToString();
i = Names.Length;
}
}
System.Console.WriteLine(uninstall);
System.Diagnostics.Process FProcess = new System.Diagnostics.Process();
string temp = "/x{" + uninstall.Split("/".ToCharArray())[1].Split("I{".ToCharArray())[2];
FProcess.StartInfo.FileName = uninstall.Split("/".ToCharArray())[0];
FProcess.StartInfo.Arguments = temp;
FProcess.StartInfo.UseShellExecute = false;
FProcess.Start();
System.Console.Read();