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 - I give up, please help me. - FIXEDDDDDD!!!

 
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: Wed Jun 25, 2008 1:15 pm    Post subject: Registry - I give up, please help me. - FIXEDDDDDD!!! Reply with quote

Edit fixed:
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim r As String
        r = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", Nothing)
        CheckBox1.Checked = r

    End Sub


So i've spent around 5 hours trying to code around with the registry. I basically give up. Please don't tell me "just google it, its on google", because i've been googling for the past 5 hrs, and have seen basically everything on the Registry and .Net. I am going to post all that I have here, and hope that someone has the answer, because I've been doing way to much work, and I've tried everything I can.

I've made just 1 form with a CheckBox and a Button on it.

Every time a user "checks" the CheckBox, it updates the registry:

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


In the button, it tells me the state of the Checkbox using MsgBox:
Code:
Dim r As String
        r = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", Nothing)

        If r = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", True) Then
            MsgBox("CheckBox is checked")
        ElseIf r = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", False) Then
            MsgBox("CheckBox is not checked")
        End If

    End Sub


Registry pic: Now says "True/False" instead of that data line.

_________________


Last edited by AndrewMan on Wed Jun 25, 2008 4:58 pm; edited 5 times in total
Back to top
View user's profile Send private message
HomerSexual
Grandmaster Cheater Supreme
Reputation: 5

Joined: 03 Feb 2007
Posts: 1657

PostPosted: Wed Jun 25, 2008 1:36 pm    Post subject: Reply with quote

instead of checking if it's true check if it's 1 or 0
_________________
Back to top
View user's profile Send private message
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Wed Jun 25, 2008 1:37 pm    Post subject: Reply with quote

blankrider wrote:
instead of checking if it's true check if it's 1 or 0


Tried, still doesn't work.

_________________
Back to top
View user's profile Send private message
lurc
Grandmaster Cheater Supreme
Reputation: 2

Joined: 13 Nov 2006
Posts: 1900

PostPosted: Wed Jun 25, 2008 1:50 pm    Post subject: Reply with quote

Set the value of the CheckState instead of the CheckBox?
Like instead of "CheckBox1" do "CheckBox1.Checked" or w/e the thing is.

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

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Wed Jun 25, 2008 1:56 pm    Post subject: Reply with quote

lurc wrote:
Set the value of the CheckState instead of the CheckBox?
Like instead of "CheckBox1" do "CheckBox1.Checked" or w/e the thing is.


Tried that. Still giving me "CheckBox is checked" every time I click the damn button.

This is driving me crazy. Im so pissed off lol. I don't see why this is not working...

Do you know how to make it DWord?

_________________
Back to top
View user's profile Send private message
atom0s
Moderator
Reputation: 205

Joined: 25 Jan 2006
Posts: 8587
Location: 127.0.0.1

PostPosted: Wed Jun 25, 2008 4:38 pm    Post subject: Reply with quote

REG_SZ is a string entry, not a simple yes/no thing in most cases. Such as yours, your entire string inside that entry would need to be compared, not just the first part. Instead of making it a long ass entry like that, just make the name something more forward to that checkbox and use a REG_DWORD entry for the value.

You should really name your controls based on what they are for for this reason.

CheckBox1 for example is misleading and unhelpful to you later down the road if you pick the project back up. You might not remember what the checkbox was for and deal with having to completely relearn your own project. Instead you can do things like:

chkHealthHack
chkAutoattack

And so on (just examples) to better keep track of things. Then you could even in the registry name the entries the control names to make it easier to understand and such.

_________________
- Retired.
Back to top
View user's profile Send private message Visit poster's website
AndrewMan
Grandmaster Cheater Supreme
Reputation: 0

Joined: 01 Aug 2007
Posts: 1257

PostPosted: Wed Jun 25, 2008 4:50 pm    Post subject: Reply with quote

OMG I FIXED IT!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Form load:

Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim r As String
        r = My.Computer.Registry.GetValue("HKEY_CURRENT_USER\TestKey", "CheckBox Values", Nothing)
        CheckBox1.Checked = r

    End Sub

_________________
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