setup wizard and registry handling
-
I want to know how can i check whether certain key value exist in registry while using Visual Studio 2003 IDE for a Setup Wizard. I want to do this programmatically. Regards, Asim
Imports Microsoft.Win32 Public Function ReadRegKeyValue(ByVal KeyName As String, _ ByVal ValueName As String) As String ' Read the value of an existing registry key ' Pass: KeyName Name or path of the registry key for which the ' value is being read ' Return: String The sub key value (zero length string if the ' sub key does not exist) ' Create an instance of the RegistryKey class from the Microsoft.Win32 namespace Dim RegObject As RegistryKey Dim RegKeyValue As String ' Retrieve the sub key value Try RegObject = Registry.LocalMachine.OpenSubKey(KeyName, False) RegKeyValue = CType(RegObject.GetValue(ValueName, ""), String) RegObject.Close() Catch RegKeyValue = "" End Try Return RegKeyValue End Function Do or not do. There is no try.
-
I want to know how can i check whether certain key value exist in registry while using Visual Studio 2003 IDE for a Setup Wizard. I want to do this programmatically. Regards, Asim
If you are doing this in a custom action, then I recommend the previous poster's answer. If you are doing this to check for the existence of a key and want to know its value, then perform the following steps:
- Right click on your setup project in the Solution Explorer
- Choose View > Launch Conditions from the context menu
- Right click on "Search Target Machine" in the Launch Conditions window
- Choose "Add Registry Search"
- Name the new item and fill out its properties in the Properties viewer
Now that property that you've created for the value of the registry key will hold the value that you sought. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
If you are doing this in a custom action, then I recommend the previous poster's answer. If you are doing this to check for the existence of a key and want to know its value, then perform the following steps:
- Right click on your setup project in the Solution Explorer
- Choose View > Launch Conditions from the context menu
- Right click on "Search Target Machine" in the Launch Conditions window
- Choose "Add Registry Search"
- Name the new item and fill out its properties in the Properties viewer
Now that property that you've created for the value of the registry key will hold the value that you sought. "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty
-
Thank you Curtis. Yes, this is what i was interested in. The other post was just about registry action using vb.net and not about what i asked! Regards, Asim
Asim, Glad to help. Happy coding! "we must lose precision to make significant statements about complex systems." -deKorvin on uncertainty