|
-
Mar 7th, 2007, 03:02 PM
#1
Thread Starter
Frenzied Member
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.
-
Mar 7th, 2007, 04:14 PM
#2
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?
The most difficult part of developing a program is understanding the problem.
The second most difficult part is deciding how you're going to solve the problem.
Actually writing the program (translating your solution into some computer language) is the easiest part.
Please indent your code and use [HIGHLIGHT="VB"] [/HIGHLIGHT] tags around it to make it easier to read.
Please Help Us To Save Ana
-
Mar 7th, 2007, 04:24 PM
#3
Thread Starter
Frenzied Member
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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|