Wed
20
Jun '07
The below code is for listing installed softwares in a windows machine with Managed C++.
RegistryKey^ rk = RegistryKey::OpenRemoteBaseKey(RegistryHive::LocalMachine, System::Environment::MachineName);
RegistryKey^ rkprograms = rk->OpenSubKey(“Software\Microsoft\Windows\CurrentVersion\Uninstall”,RegistryKeyPermissionCheck::ReadSubTree,System::Security::AccessControl::RegistryRights::FullControl);
array<string ^,1>^ rksubkeynames = rkprograms->GetSubKeyNames();
for (int i=0;i<rksubkeynames ->Length;i++) {
Object ^app = rkprograms->OpenSubKey(rksubkeynames[i])->GetValue(“DisplayName”);
if (app) {
listBox1->Items->Add(app);
}
}</rksubkeynames></string>

Leave a passing comment »