|
-
Apr 24th, 2011, 12:55 PM
#1
Thread Starter
Hyperactive Member
[RESOLVED] My program creates invisible registry keys...
My program runs this code to add an autostart key to the registry:
Code:
Registry.SetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run", "MyAppName", "" + Application.ExecutablePath + "");
The problem here is that I can't see the key it has created in regedit.
If I run some code to get the value of the key in my program, it returns a correct value. Meaning that the program can read the key but I can't.
Wt*? 
I am admin btw and have UAC off.
EDIT: Another question too: Why can I set a value with the above code but I receive an unauthorizedexception when doing it with the OpenSubKey thingy?
Last edited by Cyb3rH4Xter; Apr 24th, 2011 at 12:58 PM.
-
May 11th, 2011, 04:53 AM
#2
Fanatic Member
Re: My program creates invisible registry keys...
Have you any anti-virus program turned on that prevents wirtes to the registry. If so, disable your anti-virus and see if that helps.
-
May 11th, 2011, 02:22 PM
#3
Re: My program creates invisible registry keys...
If you have a 64bit Windows version the reg-key might be:
HKEY_LOCAL_MACHINE\SOFTWARE\Wow6232Node\Microsoft\Windows\CurrentVersion\Run
-
May 11th, 2011, 02:37 PM
#4
Thread Starter
Hyperactive Member
Re: My program creates invisible registry keys...
That was it 
Weird that it created the key there when I told it not to :P
-
May 11th, 2011, 06:13 PM
#5
Re: My program creates invisible registry keys...
Off topic but, what's the point of concatenating empty string literals?
Code:
"" + Application.ExecutablePath + ""
-
May 12th, 2011, 02:01 PM
#6
Thread Starter
Hyperactive Member
Re: My program creates invisible registry keys...
Woah typing error, It should be Chr(36), or """" of course
-
May 12th, 2011, 05:46 PM
#7
Re: My program creates invisible registry keys...
 Originally Posted by Cyb3rH4Xter
Woah typing error, It should be Chr(36), or """" of course 
That would be for VB. In C# you could do this:or this:but I'd sooner use String.Format in both languages:
Code:
string.Format("\"{0}\"", str)
It's no more correct but, to me, it's clearer.
-
May 13th, 2011, 07:51 AM
#8
Thread Starter
Hyperactive Member
Re: [RESOLVED] My program creates invisible registry keys...
Of course....I can use the backslash :P thx for the tips :-)
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
|