Jump to content

Should a registry key always be set with a value?


Recommended Posts

Just a quick one

On something im doing it sets a key based on essentially a yes or no question like this but im getting some weird answers on some parts of the gui and i wondered if this was causing it

Local $WinUpdateCheck = MsgBox($MB_YESNO + $MB_ICONWARNING + $MB_DEFBUTTON2, 'Update Check', 'Are The Updates Completed')
                    If $WinUpdateCheck = 6 Then
                        GUICtrlSetImage($WinUpdateIcon, $tick)
                        RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Updates', 'REG_SZ', _Date_Time_SystemTimeToDateTimeStr($CuDate))
                    ElseIf $WinUpdateCheck = 7 Then
                        GUICtrlSetImage($WinUpdateIcon, $cross)
                        RegWrite('HKEY_LOCAL_MACHINE\SYSTEM\Setup\Simple', 'Updates', 'REG_SZ', 'False')
                    EndIf

So the question really is should i set the negative key as the word False?

O should it be set as '' , does it matter setting a word what happens if the key doesn't exist ? that would make a third condition wouldn't it

So should i set the key differently than i am

Advice please

Link to comment
Share on other sites

That key path is non existent in my Registry (Win 7), so I'm presuming this is made by your program?

If so, then as your program is also reading the value back, then you should be able to put pretty much what you like as the value.

If not, then you need to know what is the acceptable options for that key, by the program that creates it.

But if you are just asking whether the value can be empty, then I don't see why not, as you are using it a bit like an INI file. But of course, it depends on whether you want a default value returned. The Help file, I seem to remember discusses Registry default value.

Edited by TheSaint

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Link to comment
Share on other sites

Yes sorry i create the key based on a yes no msgbox

The yes key is the date the item was finished, the other one is just not the first condition it could be anything i guess

My concern was using False when i have other conditions in the script that return True / False and i didnt want it to clash

Thats why i wondered if  '' was a better option as it would also catch the key not being created as well

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...