10-03-2010, 10:13 AM
Hello everyone. This will be a simple tutorial on how to use common registry commands that can bond in to your application.
We will be going over the following:
1) Adding a Registry Key to the Registry
2) Removing a Registry Key
-----------------------------------------------
WARNING: You Must Be Running the Application as an Administrator if you are using Windows Vista/7, XP Users need to use this technique
only when accessing the LOCAL_MACHINE.
1) Adding a Registry Key
First things first, add to the very top of the code form, Imports Microsoft.Win32.
Now for the Button1 Code:
Below is a condensed version for the code or CURRENT_USER Directory in the Registry.
Now here is something you NEVER knew about. The value type, is it DWord? QWord? Binary? String? MultiString? ExpandString or even Unknown?
Below is a code of writing a key into a specific place in the registry.
2) Removing a Registry Key
Now we will remove the registry key we created in the first place.
Now if we had taken off the Worked and My Reg Key + RegistryValueKind.DWord and it wouldv'e looked like this:
THE END.
I hope this might have helped you guys... somewhat
We will be going over the following:
1) Adding a Registry Key to the Registry
2) Removing a Registry Key
-----------------------------------------------
WARNING: You Must Be Running the Application as an Administrator if you are using Windows Vista/7, XP Users need to use this technique
only when accessing the LOCAL_MACHINE.
1) Adding a Registry Key
First things first, add to the very top of the code form, Imports Microsoft.Win32.
Code:
Imports Microsoft.Win32
Public Class Form1
Now for the Button1 Code:
Below is a condensed version for the code or CURRENT_USER Directory in the Registry.
Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Registry.CurrentUser.SetValue("RandomKey", "My Reg Key", "Worked", "RegistryValueKind.DWord") 'The RandomKey is the actual key that stores multiple registry files.
MsgBox("Registry Key created successfully created.",64,"Registry Key Creator") 'The name of the key is My Reg Key and the value is Worked.
End Sub
Now here is something you NEVER knew about. The value type, is it DWord? QWord? Binary? String? MultiString? ExpandString or even Unknown?
Below is a code of writing a key into a specific place in the registry.
Code:
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Registry.SetValue("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced", "RandomKey", "0", RegistryValueKind.DWord")
End Sub
2) Removing a Registry Key
Now we will remove the registry key we created in the first place.
Code:
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Registry.CurrentUser.DeleteValue("RandomKey", "My Reg Key", "Worked", "RegistryValueKind.DWord")
MsgBox("Registry key value has been deleted", 16,"Registry Key Creator")
End Sub
Now if we had taken off the Worked and My Reg Key + RegistryValueKind.DWord and it wouldv'e looked like this:
Code:
Registry.CurrentUser.DeleteValue("RandomKey") ' Thus deleting the actual key.
THE END.
I hope this might have helped you guys... somewhat