Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I was wonderinf it was at all possible to make it so that when the application starts up the user has a enter a Product key, or serial number. But once they have entered it, the next time they open the app they don't have to enter the number in ever again.

if you know how, please post.

Posted (edited)
How about if the program tries to search the key from a specific location in windows registry. Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Posted (edited)
The thing is, its so easy to search the registry and delete/change items that you think may help you bypass the key...

 

But if you enter the right product key = application works = you know the right key. So what does it matter where or how you save it ? :)

 

Program just tries to find a specific key from the specific location in winreg. If the key is wrong or missing = program whine.

 

Am I missing a point or something but I dont know why you should crypt the key if you already know it (?)

Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Posted

how about using text file?

 

FileOpen(1, Application.StartupPath & "/" & "Key.txt", OpenMode.Input)

Input(1, key)

 

if key="what you want" then

'process

else

'process

end if

 

FileClose(1)

 

'make this file in some place where could be hidden fromthe user.

'this is other way to replace registry.

George C.K. Low

Posted
But if you enter the right product key = application works = you know the right key. So what does it matter where or how you save it ? :)

 

Program just tries to find a specific key from the specific location in winreg. If the key is wrong or missing = program whine.

 

Am I missing a point or something but I dont know why you should crypt the key if you already know it (?)

 

Its not the key you have to save, its the fact that the key has been validated and doesn't need to be validated again. YOu can't persist that it your app, so you have to store it in the registry, or a encrypted (or not) text/xml/binary file.

Posted (edited)
Its not the key you have to save, its the fact that the key has been validated and doesn't need to be validated again. YOu can't persist that it your app, so you have to store it in the registry, or a encrypted (or not) text/xml/binary file.

 

And what do you mean by store 'it' ?, if it is not a key ?

Edited by DR00ME

"Everything should be made as simple as possible, but not simpler."

"It's not that I'm so smart , it's just that I stay with problems longer ."

- Albert Einstein

Posted
You could even have both, a file in the registry and some file randomly placed on the hard-drive - JUST REMEMBER TO REMOVE THEM DURING THE UNINSTALL! There is nothing worst then a programmer thinking he is so important he can clutter up your PC with leftovers.
Posted

This is a pretty simple example to extract your IE version from the registry. To set a value use the SetValue instead of GetValue function.

 

Dim myKey As Microsoft.Win32.RegistryKey        
Dim strLocation As String        
Dim strKey As String        

strLocation = "SOFTWARE\Microsoft\Internet Explorer"        
strKey = "Version"   
    
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)        
MessageBox.Show(myKey.GetValue(strKey))        
myKey.Close()

Posted
thank you for that code... I understand things alittle better... I have another question though... for example: if I have the registry read a value with that code... what is the code to change a value. or insert a value?
Posted

This code assumes that the registry items already exist, inserting new values is a new can of worms, but usually you'd do this during application setup.

 

To set a value, like I said, use the SetValue function, so:

Dim myKey As Microsoft.Win32.RegistryKey        
Dim strLocation As String        
Dim strKey As String        

strLocation = "SOFTWARE\Microsoft\Internet Explorer"        
strKey = "Version"   
    
myKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(strLocation)        
myKey.SetValue(strKey)  = "[value to set]"
myKey.Close()

 

well something like that, i'm doing this from memory...

Posted

When you open a subkey and want to write a value, you need to use the OpenSubKey with the signature:

public RegistryKey OpenSubKey(string, bool);

The boolean specifies if you want write access. You need write access to change a value (or add a new one).

Nothing is as illusive as 'the last bug'.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...