-
Mar 7th, 2007, 11:12 AM
#1
Thread Starter
Frenzied Member
[RESOLVED by schoolbusdrive]Save to registry, but it doesn't!
I have the following code to save the forms position when it is closed, but when it runs through the Reg.bas if errors out on this line:
Code:
If rv <> REGISTRY_SUCCESS Then GoTo ErrorHandler
Code:
Dim vSubKey As String
vSubKey = "Software\Deftech\CodeLibrary\2.0\Config"
SaveRegistryValue regLong, hkeyLOCAL_MACHINE, vSubKey, "Left", Me.Left
SaveRegistryValue regLong, hkeyLOCAL_MACHINE, vSubKey, "Top", Me.Top
SaveRegistryValue regLong, hkeyLOCAL_MACHINE, vSubKey, "Height", Me.Height
SaveRegistryValue regLong, hkeyLOCAL_MACHINE, vSubKey, "Width", Me.Width
Is there something else I should be doing to make a new entry in the registry.
The app is just for me, so I could manually enter the new keys, but I would like to know how to create them properly.
Last edited by aikidokid; Mar 9th, 2007 at 09:13 AM.
-
Mar 7th, 2007, 11:13 AM
#2
Re: Save to registry, but it doesn't!
-
Mar 7th, 2007, 11:24 AM
#3
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
This code was given to me ages ago by a friend, but I cannot quite remember how to use it properly
It goes to this line and then returns the error message:
vb Code:
If rv <> REGISTRY_SUCCESS Then GoTo ErrorHandler
vb Code:
Public Function SaveRegistryValue(ValueType As enumRegistryValueType, _
TopLevelKey As enumTopLevelKey, _
SUBKEY As String, _
RegistryItemName As String, _
RegistryData As Variant) As Boolean
'init
Dim hKey As Long
Dim hCurrKey As Long
Dim vDataType As Long
Dim vDataBufferSize As Long
Dim rv As Long
Select Case ValueType
Case regString
'create string buffer
Dim vStrBuffer As String
vDataType = REG_SZ
Case regLong
'create long buffer
Dim vBuffer As Long
vDataType = REG_DWORD
End Select
'init values
SaveRegistryValue = True
hKey = TopLevelKey
hCurrKey = 0
rv = 0
'populate buffer
Select Case ValueType
Case regString
vStrBuffer = CStr(RegistryData) & vbNullChar
vDataBufferSize = Len(vStrBuffer)
Case regLong
vBuffer = CLng(RegistryData)
vDataBufferSize = 4
End Select
'open registry key - handle returned in `hCurrKey`
rv = RegOpenKeyEx(hKey, SUBKEY, 0, KEY_ALL_ACCESS, hCurrKey)
If rv <> REGISTRY_SUCCESS Then GoTo ErrorHandler
'set key value
Select Case ValueType
Case regString
rv = RegSetValueEx(hCurrKey, RegistryItemName, _
0, vDataType, ByVal vStrBuffer, _
vDataBufferSize)
Case regLong
rv = RegSetValueEx(hCurrKey, RegistryItemName, _
0, vDataType, vBuffer, vDataBufferSize)
End Select
If rv <> REGISTRY_SUCCESS Then GoTo ErrorHandler
'close key
rv = RegCloseKey(hCurrKey)
If rv = REGISTRY_SUCCESS Then Exit Function
ErrorHandler:
On Error Resume Next
'attempt to close key
rv = RegCloseKey(hCurrKey)
SaveRegistryValue = False
End Function
Last edited by aikidokid; Mar 7th, 2007 at 11:35 AM.
-
Mar 7th, 2007, 11:44 AM
#4
Re: Save to registry, but it doesn't!
I'll repeat Hack's question for emphasis:
WHAT error message? "The" error message doesn't tell us what the error is. I'm guessing that you haven't defined REGISTRY_SUCCESS.
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, 12:00 PM
#5
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
I'm not quite sure how to explain this.
I have this code in the form_unload:
vb Code:
SaveRegistryValue regLong, hkeyLOCAL_MACHINE, vSubKey, "Left", Me.Left
When I step through the code, it then, after this line, takes me to the Registry.Bas, shown in post #3
It goes as far as the line:
vb Code:
If rv <> REGISTRY_SUCCESS Then GoTo ErrorHandler
It then goes to the ErrorHandler and then exits the sub.
Registry_success is defined as
vb Code:
Public Const REGISTRY_SUCCESS = 0&
I am only assuming that because there is not already a key for this in the registry, that it doesn't write to it.
That's why I asked if there was something else I should be doing to write this to the registry for the first time.
I hope this is a bit clearer
-
Mar 7th, 2007, 12:17 PM
#6
Re: Save to registry, but it doesn't!
Originally Posted by aikidokid
I am only assuming that because there is not already a key for this in the registry, that it doesn't write to it.
That is correct. RegSetValueEx requires an pre-existing subkey if you're not writing a value directly to the hive's root. Use RegCreateKeyEx to create the subkey first.
As an aside, it's not good practice to use KEY_ALL_ACCESS, as this is likely to fail if you're not logged-in as admin. Use KEY_CREATE_SUB_KEY and KEY_SET_VALUE as appropriate.
EDIT From MSDN:
Unlike the RegCreateKeyEx function, the RegOpenKeyEx function does not create the specified key if the key does not exist in the registry.
The initial error will actually occur in RegOpenKeyEx.
Last edited by schoolbusdriver; Mar 7th, 2007 at 12:31 PM.
-
Mar 7th, 2007, 12:47 PM
#7
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Thanks schoolbusdriver
That is correct. RegSetValueEx requires an pre-existing subkey if you're not writing a value directly to the hive's root. Use RegCreateKeyEx to create the subkey first.
So I would create the Parent Key first, and I'm guessing the sub keys, if needed.
Then, each time the app runs, just check the key exists.
Is this correct?
-
Mar 7th, 2007, 03:12 PM
#8
Re: Save to registry, but it doesn't!
Nearly . RegCreateKeyEx has a double purpose. If the subkey already exists, it opens it. Whether the key pre-exists or not, it returns a handle to it. The branch to the subkey is created automatically.
Typically, to create a value, irrespective of whether you know it already exists, you'd do: RegCreateKeyEx > RegOpenKeyEx > RegSetValueEx > RegCloseKey.
To read a value, irrespective of whether you know it already exists, you'd do: RegOpenKeyEx > RegQueryValueEx (to get the type of data) > RegQueryValueEx (to get the actual data) > RegCloseKey. And return a default value or error code if RegOpenKeyEx or the first RegQueryValueEx failed.
If you're feeling lazy , search my previous posts using the above function names as keywords.
-
Mar 7th, 2007, 03:36 PM
#9
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Thanks schoolbusdriver.
So this answer would answer my question here I would think
-
Mar 7th, 2007, 03:44 PM
#10
Re: Save to registry, but it doesn't!
Yes. Some of my posts show how to write/read DWORDs (for the Left, Top etc values). If you have any trouble.......
There's also way to write/read a UDT containing all the values to a REG_BINARY or REG_NONE, in one call. but If you're happy saving them as individual values....
-
Mar 7th, 2007, 03:45 PM
#11
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Thanks alot schoolbusdriver, you've been a great help.
I think I will stick with the individual values to start with.
-
Mar 7th, 2007, 04:10 PM
#12
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Still struggling a bit here ..
I have the following, but am getting an error message here:
Code:
RegSetValueEx Ret, HKEY_LOCAL_MACHINE, vSubKey, 0, "REG_DWORD",
I know there is something missing from the end, but I'm not quite sure what goes there!!
vb Code:
Dim Ret
Dim vSubKey As String
vSubKey = "Software\Deftech\CodeLibrary\2.0"
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
RegOpenKeyEx HKEY_LOCAL_MACHINE, vSubKey, 0, KEY_ALL_ACCESS, Result
RegSetValueEx Ret, HKEY_LOCAL_MACHINE, vSubKey, 0, "REG_DWORD",
RegCloseKey Ret
Any pointers in the right direction would be great.
-
Mar 7th, 2007, 04:31 PM
#13
Re: Save to registry, but it doesn't!
Hmmm... a few issues... (I've not actually run this....)
vb Code:
Dim vSubKey As String
Dim Ret As Long
Dim Result As Long
Dim lngKeyHandle As Long
vSubKey = "Software\Deftech\CodeLibrary\2.0"
'Check if the specified key exists
Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, vSubKey, 0&, KEY_ALL_ACCESS, lngKeyHandle)
If Result <> 0 Then 'Key doesn't exist. 0 signifies success.
'Create a new key
Result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, vSubKey, ByVal 0&, REG_DWORD, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, lngKeyHandle, Ret)
If Result <> 0 Then '0 signifies success.
MsgBox "Error while creating the Key!!"
Exit Sub
End If
'Open the new key.
RegOpenKeyEx HKEY_LOCAL_MACHINE, vSubKey, 0&, KEY_ALL_ACCESS, lngKeyHandle
End If
'Now that we have a valid handle...
'Give it a value of say, 25
'The 4 signifies the length of the value. For a DWORD (Long) it's always 4.
RegSetValueEx lngKeyHandle, HKEY_LOCAL_MACHINE, vSubKey, 0&, "REG_DWORD", 25, 4
RegCloseKey lngKeyHandle
Last edited by schoolbusdriver; Mar 7th, 2007 at 06:11 PM.
Reason: Found out how the =vb tag works
-
Mar 8th, 2007, 08:22 AM
#14
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
I am now getting an error here on this line - wrong number of arguments:
vb Code:
RegSetValueEx lngKeyHandle, HKEY_LOCAL_MACHINE, vSubKey, 0&, "REG_DWORD", 25, 4
I have removed the "lngKeyHandle" part and now get type mismatch!!
-
Mar 8th, 2007, 11:41 AM
#15
Re: Save to registry, but it doesn't!
My fault, it was getting late . It's the "HKEY_LOCAL_MACHINE" parameter that wants removing - the handle to the open key is contained in lngKeyHandle.
=vb Code:
RegSetValueEx lngKeyHandle, vSubKey, 0&, REG_DWORD, 25, 4
EDIT: REG_DWORD should not be in quotation marks.
Last edited by schoolbusdriver; Mar 8th, 2007 at 11:47 AM.
-
Mar 8th, 2007, 11:49 AM
#16
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Thanks for all your help with this problem.
So once I check, for the key, create it, add a value to it and then close it, that should be it for that one key. Yes?
What or where have I names the key?
Do I have to add a value to the key straight away?
For example, I create a key to hold the form top value. Do I need to give it a value straight away, or once it's created, add the value at form_unload.
-
Mar 8th, 2007, 12:02 PM
#17
Re: Save to registry, but it doesn't!
As it stands the code will create the subkey [HKEY_LOCAL_MACHINE\SOFTWARE\Deftech\CodeLibrary\2.0] and a value name of "Software\Deftech\CodeLibrary\2.0" with the DWORD value of 25. As you want to save "Left = XXX", "Top = XXX" etc, you need to something like this in the "Query_Unload" event, ie before the form starts unloading - maybe a "Save changes ?" message.
RegSetValueEx lngKeyHandle, "Left", 0&, REG_DWORD, Form1.Left, 4
RegSetValueEx lngKeyHandle, "Top", 0&, REG_DWORD, Form1.Top, 4
RegSetValueEx lngKeyHandle, "Width", 0&, REG_DWORD, Form1.Width, 4
RegSetValueEx lngKeyHandle, "Height", 0&, REG_DWORD, Form1.Height, 4
That does the saving. You'd read the values in the Form_Load event. Do you have reading code ?
-
Mar 8th, 2007, 12:14 PM
#18
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Ok, so I don't have to assign a value straight away, thats good, I've got that.
So with your example above, the name of the key would be "Left", is that right?
Sorry for beng a bit slow here, but where did I name the actual key
a value name of "Software\Deftech\CodeLibrary\2.0"
-
Mar 8th, 2007, 12:48 PM
#19
Re: Save to registry, but it doesn't!
No worries - at least you're trying . (Some people seem to expect you to write their projects for them )
The value name is the second parameter "vSubKey" in
vb Code:
RegSetValueEx lngKeyHandle, vSubKey, 0&, REG_DWORD, 25, 4
which (originally) references
vb Code:
vSubKey = "Software\Deftech\CodeLibrary\2.0"
Actually, I've just spotted a flaw in my previous post . RegSetValueEx expects a pointer to a variable, not the property of the form directly. So to save the values you have to do:
vb Code:
Dim FrmLeft as long
'etc
'etc...
FrmLeft = Form1.Left
'etc
'etc...
RegSetValueEx lngKeyHandle, "Left", 0&, REG_DWORD, FrmLeft, 4
'etc
'etc...
-
Mar 8th, 2007, 12:57 PM
#20
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Originally Posted by schoolbusdriver
No worries - at least you're trying
that has been said many times
Originally Posted by schoolbusdriver
Some people seem to expect you to write their projects for them
Well, that would certainly be a hell of a lot quicker, but then again, I am doing this because I am trying to teach myself something.
Thanks alot for all this. It now gives me a decent basic understanding of how to read/write to the registry.
Originally Posted by schoolbusdriver
Do you have reading code ?
Not too sure, but an example would be good please. Is it using the GetSetting?
Is this a speciallity of yours, as there seem to be a lot of posts from you on this topic?
-
Mar 8th, 2007, 01:30 PM
#21
Re: Save to registry, but it doesn't!
Originally Posted by aikidokid
...I am doing this because I am trying to teach myself something.
Originally Posted by aikidokid
...Is it using the GetSetting?
Nah! See below.
Originally Posted by aikidokid
Is this a speciallity of yours, as there seem to be a lot of posts from you on this topic?
Yes
vb Code:
Dim lngKeyHandle As Long
Dim lngDataType As Long
Dim lngDataSize As Long
Dim lngRetval As Long
Const lnghKey = HKEY_LOCAL_MACHINE
Const strSubKey = "Software\Deftech\CodeLibrary\2.0"
Const strValueName = "Left"
'Open the key.
If RegOpenKeyEx(lnghKey, strSubKey, 0&, KEY_ALL_ACCESS, lngKeyHandle) = ERROR_SUCCESS Then
'Get the key`s data length. It should ALWAYS return ERROR_MORE_DATA.
If RegQueryValueEx(lngKeyHandle, strValueName, 0&, lngDataType, 0&, lngDataSize) _
= ERROR_MORE_DATA Then
'Test for DWORD value.
If lngDataType = REG_DWORD Then
'Get the key`s content.
If RegQueryValueEx(lngKeyHandle, strValueName, 0&, 0&, lngRetval, lngDataSize) <> ERROR_SUCCESS Then MsgBox "OOPS!"
End If
End If
End If
'Close any key opened with RegOpenKeyEx.
Call RegCloseKey(lngKeyHandle)
Debug.Print lngRetval
As before, I've done this on the fly, so I've not run it.....
-
Mar 9th, 2007, 06:51 AM
#22
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
I am now getting an error on this line, saying type mismatch!
vb Code:
RegSetValueEx lngKeyHandle, "Left", 0&, "REG_DWORD", lngFrmLeft, 4
But from what you have shown above, this should be correct, shouldn't it?
lngKeyHandle = HKEY_LOCAL_MACHINE
"Left" = The name given to the key
lngFrmLeft = Me.Left
vb Code:
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Dim lngKeyHandle As Long
Dim lngFrmLeft As Long
Dim lngFrmTop As Long
Dim Ret As Long
Dim Result As Long
Const strSubKey = "Software\Deftech\CodeLibrary\2.0"
FrmLeft = Me.Left
FrmTop = Me.Top
'open keys
'Check if the specified key exists
Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strSubKey, 0&, KEY_ALL_ACCESS, lngKeyHandle)
If Result <> 0 Then
'Key doesn't exist. 0 signifies success.
'Create a new key
Result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Left", ByVal 0&, REG_DWORD, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, lngKeyHandle, Ret)
If Result <> 0 Then '0 signifies success.
MsgBox "Error while creating the Key!!"
Exit Sub
End If
'Open the new key.
RegOpenKeyEx HKEY_LOCAL_MACHINE, "Left", 0&, KEY_ALL_ACCESS, lngKeyHandle
End If
'Now that we have a valid handle - Give it a value
'The 4 signifies the length of the value. For a DWORD (Long) it's always 4.
RegSetValueEx lngKeyHandle, "Left", 0&, "REG_DWORD", lngFrmLeft, 4
'close the opened key
RegCloseKey lngKeyHandle
-
Mar 9th, 2007, 07:10 AM
#23
Re: Save to registry, but it doesn't!
-
Mar 9th, 2007, 07:21 AM
#24
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Originally Posted by schoolbusdriver
See my little (almost unnoticeable) edit in post 15
I do now
When I am opening the form, and checking to see if the key exists, I am now getting an error on this line saying "ERROR_SUCCESS" is not defined.
[B]EDIT[\B]Also with ERROR_MORE_DATA as well, same error.
Is this your variable, or is it from the API?
vb Code:
If RegOpenKeyEx(lnghKey, strSubKey, 0&, KEY_ALL_ACCESS, lngKeyHandle) = ERROR_SUCCESS Then
I won't give up if you dont!
Last edited by aikidokid; Mar 9th, 2007 at 07:27 AM.
-
Mar 9th, 2007, 07:27 AM
#25
Re: Save to registry, but it doesn't!
Originally Posted by aikidokid
I won't give up if you dont!
I won't, but will have to go and do a couple of hours work soon
ERROR_SUCCESS is a standard API constant of 0. REGISTRY_SUCCESS, which I noticed somewhere in the first couple of posts is the same.
EDIT:
'Registry return values.
Public Const ERROR_SUCCESS = 0&
Public Const ERROR_MORE_DATA = 234
Public Const ERROR_NO_MORE_ITEMS = 259&
Last edited by schoolbusdriver; Mar 9th, 2007 at 07:31 AM.
-
Mar 9th, 2007, 07:33 AM
#26
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Thanks once again.
Originally Posted by schoolbusdriver
I won't, but will have to go and do a couple of hours work soon
I have a couple of days off now, so I am trying to get stuck into this.
Not sure where you are, but from something you said in one of your threads, I think there is a time difference between us.
I'm sure I will post again, I am just grateful for an answer whenever you can
-
Mar 9th, 2007, 07:38 AM
#27
Re: Save to registry, but it doesn't!
No problem, (UK based). I'll help when I can
-
Mar 9th, 2007, 08:04 AM
#28
Thread Starter
Frenzied Member
-
Mar 9th, 2007, 08:37 AM
#29
Thread Starter
Frenzied Member
Re: [RESOLVED by schoolbusdriver]Save to registry, but it doesn't!
Hmm, thought I did.
I am getting the error:
User defined type may not be passed ByVal
on this line of code:
vb Code:
Result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "StartOption", ByVal 0&, REG_DWORD, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, lngKeyHandle, Ret)
on the "ByVal 0&" part.
I have this line of code elsewhere and it works without this error:
vb Code:
Result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "Left", ByVal 0&, REG_DWORD, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, lngKeyHandle, Ret)
Now I'm not too sure what this means, but looking at the API code it says:
lpSecurityAttributes As Any
But when I type the code out, the intellisense (or what ever the tooltiptext is called) it says
lpSecurityAttributes As SECURITY_ATTRIBUTES
Does this matter, or make any sense?
vb Code:
Dim lngKeyHandle As Long
Dim Ret As Long
Dim Result As Long
Const strSubKey = "Software\Deftech\CodeLibrary\2.0"
'SelectedOption holds the option button index number
'Check if the specified key exists
Result = RegOpenKeyEx(HKEY_LOCAL_MACHINE, strSubKey, 0&, KEY_ALL_ACCESS, lngKeyHandle)
If Result <> 0 Then
'Key doesn't exist. 0 signifies success.
'Create a new key
Result = RegCreateKeyEx(HKEY_LOCAL_MACHINE, "StartOption", ByVal 0&, REG_DWORD, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, ByVal 0&, lngKeyHandle, Ret)
If Result <> 0 Then '0 signifies success.
MsgBox "Error while creating the Key!!"
Exit Sub
End If
'Open the new key.
RegOpenKeyEx HKEY_LOCAL_MACHINE, "StartOption", 0&, KEY_ALL_ACCESS, lngKeyHandle
End If
'Now that we have a valid handle - Give it a value
'The 4 signifies the length of the value. For a DWORD (Long) it's always 4.
RegSetValueEx lngKeyHandle, "StartOption", 0&, REG_DWORD, SelectedOption, 4
'close the opened key
RegCloseKey lngKeyHandle
Last edited by aikidokid; Mar 9th, 2007 at 08:46 AM.
-
Mar 9th, 2007, 09:11 AM
#30
Thread Starter
Frenzied Member
Re: Save to registry, but it doesn't!
Hmmm again!
Tried it a few times and it didn't work, now I've tried it again, after restarting VB and it works each time!
Time for a coffee break
-
Mar 9th, 2007, 12:42 PM
#31
Re: [RESOLVED by schoolbusdrive]Save to registry, but it doesn't!
Ah!. (Just got back). That error message may be because of the way the RegCreateKeyEx API is declared. The 7th parameter may be declared as "lpSecurityAttributes as SECURITY_ATTRIBUTES" - a UDT. Declaring it as a Long should stop any errors. ie:
vb Code:
Public Declare Function RegCreateKeyEx Lib "advapi32.dll" Alias "RegCreateKeyExA" _
(ByVal hkey As Long, ByVal lpSubKey As String, ByVal Reserved As Long, _
ByVal lpClass As String, ByVal dwOptions As Long, ByVal samDesired As Long, _
lpSecurityAttributes As Long, phkResult As Long, lpdwDisposition As Long) As Long
-
Mar 9th, 2007, 12:59 PM
#32
Thread Starter
Frenzied Member
Re: [RESOLVED by schoolbusdrive]Save to registry, but it doesn't!
Thanks for getting back.
Originally Posted by schoolbusdriver
Declaring it as a Long should stop any errors
I only had the problem in one place, and as I said it doesn't happen anymore.
Should I still change it, and would it affect the other places where I have used it?
I would guess not, but I aint that sure
-
Mar 10th, 2007, 03:13 AM
#33
Re: [RESOLVED by schoolbusdrive]Save to registry, but it doesn't!
If it aint broke....
If lpSecurityAttributes is declared as "Any" it won't matter, as we're passing a NULL (0&) anyway. For myself, I'd be inclined to either change it or at least add some comments (such as the URL to this thread ! ) for future reference. The SECURITY_ATTRIBUTES structure is useful if you're intending to create (child) subkeys that, for instance, inherit the permissions of the parent subkey - not really an issue here as it's for your personal use (logged in as administrator).
-
Mar 10th, 2007, 04:11 AM
#34
Thread Starter
Frenzied Member
Re: [RESOLVED by schoolbusdrive]Save to registry, but it doesn't!
Originally Posted by schoolbusdriver
I'd be inclined to either change it or at least add some comments (such as the URL to this thread ! ) for future reference.
An excellent idea, I never thought of this, but it's what I will do for now, as you said, "if it aint broke ..."
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
|