Talk2Tom11 Posted February 23, 2004 Posted February 23, 2004 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. Quote
samsmithnz Posted February 23, 2004 Posted February 23, 2004 Of course its possible, you'll just have to decide on the best way of implementing it. I'd be tempted to either use an encrpyted xml configuration file, maybe one that uses the classID of the windows installation... Quote Thanks Sam http://www.samsmith.co.nz
DR00ME Posted February 23, 2004 Posted February 23, 2004 (edited) How about if the program tries to search the key from a specific location in windows registry. Edited February 23, 2004 by DR00ME Quote "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
samsmithnz Posted February 23, 2004 Posted February 23, 2004 How about if the program tries to search the key from a specific location in windows registry. The thing is, its so easy to search the registry and delete/change items that you think may help you bypass the key... Quote Thanks Sam http://www.samsmith.co.nz
DR00ME Posted February 23, 2004 Posted February 23, 2004 (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 February 23, 2004 by DR00ME Quote "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
Talk2Tom11 Posted March 1, 2004 Author Posted March 1, 2004 I am not very familiar with writing into the registry. Quote
georgepatotk Posted March 2, 2004 Posted March 2, 2004 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. Quote George C.K. Low
samsmithnz Posted March 2, 2004 Posted March 2, 2004 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. Quote Thanks Sam http://www.samsmith.co.nz
DR00ME Posted March 2, 2004 Posted March 2, 2004 (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 March 2, 2004 by DR00ME Quote "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
Jay1b Posted March 2, 2004 Posted March 2, 2004 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. Quote
Talk2Tom11 Posted March 2, 2004 Author Posted March 2, 2004 How would I go about writing something into the registry? Quote
samsmithnz Posted March 3, 2004 Posted March 3, 2004 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() Quote Thanks Sam http://www.samsmith.co.nz
Talk2Tom11 Posted March 3, 2004 Author Posted March 3, 2004 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? Quote
samsmithnz Posted March 3, 2004 Posted March 3, 2004 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... Quote Thanks Sam http://www.samsmith.co.nz
Talk2Tom11 Posted March 3, 2004 Author Posted March 3, 2004 myKey.SetValue(strKey) that part is giving me an error Quote
Wile Posted March 3, 2004 Posted March 3, 2004 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). Quote Nothing is as illusive as 'the last bug'.
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.