Save in registry as a Name
I have been using this code from the API-Guide. I am new to API's in general.
It creates a REG_DWORD in the directory I want.
How do I name the entry, for example I would like to store the position of the form when it is closed, with Left, Top, Height, Width?
vb Code:
Dim Result As Long
'Check if the specified key exists
RegOpenKeyEx HKEY_LOCAL_MACHINE, vSubKey, 0, KEY_ALL_ACCESS, Ret
'If the key doesn't exist, we create it
If Result = 0 Then
'Create a new key
RegCreateKeyEx HKEY_LOCAL_MACHINE, vSubKey, 0, "REG_DWORD", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, Result, Ret
If Result = 0 Then
MsgBox "Error while creating the Key!!"
Exit Sub
End If
End If
This runs and creates the entry, but when I run the app a second time, it doesn't create another entry, so I guess I have to insert a name, or text somewhere. :confused:
Re: Save in registry as a Name
When you run the app the second time it's not supposed to create another entry, since there's already an entry. You can only have one unambiguously-named entry in the registry. If you h ad two, which one would you read when you read that entry name?
Re: Save in registry as a Name
Thanks Al42
If you take a look at this thread, you will see better at what I was after.
I was trying to create an entry into the registry that was named, then create another o a different name, not actually another of the same name.
I didn't explain myself too well.:(