Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


Registry help .Net

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Mon Jun 23, 2008 3:57 pm    Post subject: Registry help .Net Reply with quote

Made a quick client with just a simple textbox and a button on it.

In the button:
Code:
My.Computer.Registry.SetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", CheckBox1)


In the form load:

Code:
 Dim readValue As String = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", Nothing)
        If readValue = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", 1) Then
            MsgBox("Registry updated")
            CheckBox1.Checked = True



        Else : CheckBox1.Checked = False

        End If


Its just not working. The box keeps becoming checked, and un checking is not staying.

_________________
Back to top
View user's profile Send private message
killersamurai
Expert Cheater
Reputation: 0

Joined: 10 Sep 2007
Posts: 197
Location: Colorado

PostPosted: Mon Jun 23, 2008 5:15 pm    Post subject: Reply with quote

From looking at the code you posted, there can be other problems in your code you didn't post. So, I just created an example. It's done in c# since I haven't touched vb.net in a very long time. Someone might be nice enough to translate it though.
Code:

private void btnSValue_Click(object sender, EventArgs e)
        {
            if (txtSValue.Text != String.Empty)
            {
                Microsoft.Win32.RegistryKey regSet = Microsoft.Win32.Registry.CurrentUser.OpenSubKey(
                                                                                          "Software\\Test\\Key",
                                                                                          Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree,
                                                                                          System.Security.AccessControl.RegistryRights.WriteKey);

                if (regSet == null)
                {
                    regSet = Microsoft.Win32.Registry.CurrentUser.CreateSubKey(
                                                                  "Software\\Test\\Key",
                                                                  Microsoft.Win32.RegistryKeyPermissionCheck.ReadWriteSubTree);
                    MessageBox.Show(
                               "Key created!",
                               "OK",
                               MessageBoxButtons.OK,
                               MessageBoxIcon.Information);

                }

                regSet.SetValue(
                       "Value",
                       txtSValue.Text,
                       Microsoft.Win32.RegistryValueKind.String);

                MessageBox.Show(
                           "Done",
                           "OK",
                           MessageBoxButtons.OK,
                           MessageBoxIcon.Exclamation);

                regSet.Close();
            }
            else
                MessageBox.Show(
                           "You need to enter something",
                           "Error",
                           MessageBoxButtons.OK,
                           MessageBoxIcon.Exclamation);
        }

        private void btnGValue_Click(object sender, EventArgs e)
        {
          Microsoft.Win32.RegistryKey regGet =  Microsoft.Win32.Registry.CurrentUser.OpenSubKey(
                                                                                     "Software\\Test\\Key",
                                                                                     Microsoft.Win32.RegistryKeyPermissionCheck.ReadSubTree,
                                                                                     System.Security.AccessControl.RegistryRights.QueryValues);

          if (regGet == null)
              MessageBox.Show(
                         "Key doesn't exist. Set value first!",
                         "Error",
                         MessageBoxButtons.OK,
                         MessageBoxIcon.Exclamation);
          else
          {
              if (regGet.GetValue("Value", txtGValue.Text, Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames) != null)
              {
                  txtGValue.Text = (string)regGet.GetValue(
                                                  "Value",
                                                  txtGValue.Text,
                                                  Microsoft.Win32.RegistryValueOptions.DoNotExpandEnvironmentNames);
              }
          }

          regGet.Close();
        }



The Extension 'rar' was deactivated by an board admin, therefore this Attachment is not displayed.

Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Mon Jun 23, 2008 6:35 pm    Post subject: Reply with quote

Thanks for that code. If someone could just translate that, it would be great.
_________________
Back to top
View user's profile Send private message
samuri25404
Grandmaster Cheater
Reputation: 7

Joined: 04 May 2007
Posts: 955
Location: Why do you care?

PostPosted: Mon Jun 23, 2008 6:41 pm    Post subject: Reply with quote

AndrewMan wrote:
Thanks for that code. If someone could just translate that, it would be great.


There are a number of C# -> VB.NET translators on the internet.

Please use Google.

_________________
Wiccaan wrote:

Oh jeez, watchout I'm a bias person! Locked.


Auto Assembly Tuts:
In Depth Tutorial on AA
Extended
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites