943,917 Members | Top Members by Rank

Ad:
  • VB.NET Discussion Thread
  • Unsolved
  • Views: 31002
  • VB.NET RSS
Mar 22nd, 2005
0

I want to manipulate the registry key values through a vb.net application

Expand Post »
hello every one.

i would like to tell you that i am real biggener so please reply accordingly. any kind of help would be appriciated. i was trying to clean a specific registry key's value through my application.

i have added a button now i want that on click event of that button that particular registry entry's value is cleaned.

what i want to do is to increase the typed URL history through my application.

i was told to use a namespace microsoft.win32 but i dont even know how to use the namespace.

i would like someone to guide me through.
the registry key is

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\TypedURLs

anyone can please help with this one and rest i'll do on the same traks.

Best Regards
Mohit
Similar Threads
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MohitManocha is offline Offline
4 posts
since Mar 2005
Mar 22nd, 2005
0

Re: I want to manipulate the registry key values through a vb.net application

I'm not sure what you mean by "clean" the registry key, but it's all too easy to write to the registry like this:

VB.NET Syntax (Toggle Plain Text)
  1. dim WSH
  2. set WSH = createobject("WScript.Shell")
  3. WSH.RegWrite "HKCU\Software\Microsoft\Internet Explorer\TypedURLs\url1", "http://www.google.com"

That will effectively replace the value in url1 to http://www.google.com. The most difficult Part of this will be to figure out how many url values are available. Here is a peice of code that will loop through all the registry values (urls) in that registry key, and replace them with "" (nothing).

VB.NET Syntax (Toggle Plain Text)
  1. ' /* Create Shell Object */
  2. dim WSH
  3. set WSH = createobject("WScript.Shell")
  4.  
  5. ' /* Set I To 1
  6. I = 1
  7.  
  8. ' / * Loop Without Conditions (Infinately) */
  9. do
  10. ' /* If There is any kind of error, just keep processing */
  11. on error resume next
  12.  
  13. ' /* Read The String Value In The Registry Into the url Variable */
  14. url = WSH.RegRead("HKCU\Software\Microsoft\Internet Explorer\TypedURLs\url" & I)
  15.  
  16. ' /* If The Length Of What We Read From The Registry is 0, Then Break From The Loop */
  17. if len(url) = 0 then exit do
  18.  
  19. ' /* OverWrite The Current Value (current URL) with "" chr(34) is the character code for " */
  20. WSH.RegWrite "HKCU\Software\Microsoft\Internet Explorer\TypedURLs\url" & I, chr(34) & "" & chr(34)
  21.  
  22. ' /* Reset URL */
  23. url = ""
  24.  
  25. ' /* Add One To I (To get the next URL in the registry */
  26. I = I + 1
  27. loop
  28.  
  29. ' /* All Done */
  30. msgbox "Complete!"
  31. WScript.Quit

Now, IE Still recognizes these "" values, because the values are still in the registry, but URL's have been removed. They could have been changed just as easily to say, http://www.google.com. The way to actually Remove All The Values is as such:

VB.NET Syntax (Toggle Plain Text)
  1. ' /* Create Shell Object */
  2. dim WSH
  3. set WSH = createobject("WScript.Shell")
  4.  
  5. ' /* Set I To 1
  6. I = 1
  7.  
  8. ' / * Loop Without Conditions (Infinately) */
  9. do
  10. ' /* If There is any kind of error, just keep processing */
  11. on error resume next
  12.  
  13. ' /* Read The String Value In The Registry Into the url Variable */
  14. url = WSH.RegRead("HKCU\Software\Microsoft\Internet Explorer\TypedURLs\url" & I)
  15.  
  16. ' /* If The Length Of What We Read From The Registry is 0, Then Break From The Loop */
  17. if len(url) = 0 then exit do
  18.  
  19. ' /* Delete The URL From The Registry */
  20. WSH.RegDelete "HKCU\Software\Microsoft\Internet Explorer\TypedURLs\url" & I
  21.  
  22. ' /* Reset URL */
  23. url = ""
  24.  
  25. ' /* Add One To I (To get the next URL in the registry */
  26. I = I + 1
  27. loop
  28.  
  29. ' /* All Done */
  30. msgbox "Complete!"
  31. WScript.Quit

Let me know if this helps you any
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Mar 22nd, 2005
0

Re: I want to manipulate the registry key values through a vb.net application

This really helped me a lot. thanks a lot.

now what i am focusing towards is that user gets an option to alter a registry key's value when he clicks at a link label. he gets a window displayed in front of him where the value fo the key is written. he can alter the value there and it gets altered back in the registry.

i know this is a bit smart to do but i think me on this website!!!! it is possible when you get good programers like the one who replied to me for the first time.

what i am trying to do is preety much simmlar to browser hijac restore of MS Anti Spyware.

Regards
Mohit
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MohitManocha is offline Offline
4 posts
since Mar 2005
Mar 22nd, 2005
0

Re: I want to manipulate the registry key values through a vb.net application

the key in questions is

HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main

and i want to alter the Key Value from the app directly fot he start page URL.

the key can be chaged if it is set to a particular one in button event handler butthe part of providig the user to put a value of his choice in the app and then pressing a button to replace is the diff part i think.

lets see if i have any luck eith the coders here
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MohitManocha is offline Offline
4 posts
since Mar 2005
Mar 22nd, 2005
0

Re: I want to manipulate the registry key values through a vb.net application

VB.NET Syntax (Toggle Plain Text)
  1. ' /* Create Shell Object */
  2. dim newurl
  3. dim WSH
  4. set WSH = createobject("WScript.Shell")
  5.  
  6. ' /* Get The URL From The User */
  7. newurl = inputbox("Please, Enter The New Home Page")
  8.  
  9. ' /* If They Hit Cancel, Or Leave It Blank Then Exit Sub */
  10. if newurl = "" then exit sub
  11.  
  12. ' /* Set The Home Page To The New URL */
  13. wsh.regwrite "HKCU\Software\Microsoft\Internet Explorer\Main\Start Page", newurl
  14.  
  15. ' /* Tell us It's Done */
  16. msgbox "Done!"
Team Colleague
Reputation Points: 361
Solved Threads: 214
Taboo Programmer
Comatose is offline Offline
2,413 posts
since Dec 2004
Mar 22nd, 2005
0

Re: I want to manipulate the registry key values through a vb.net application

If this keep on going like this is think that i would fall of my chair. this comasot is a real programer man. wish he was my teacher.

now since this prob have also been resolved i think now is the most appropriate time to deliever my new prob.

i want to make a friendly interface like BROWSER HIJACK RESTORE

now i want that several item like start page and search page directly come into a list view. when user clicks at it an inprutbox comes out asking for entry of the new URL or we ca set a default for every entry and when user clicks at restore all the defaults apply else user selects one click at change button and then the input box appears for changing the URl.

i think this is a real tedioud and time taking job.

i know i am asking for too much but this the way i would get to know. befor asking for help i always try to get things done by myself but i am a begineer so ti dont think i am capable of doing all this stuff.

one day when i become programer i would help others here at this exteemed website
Reputation Points: 10
Solved Threads: 0
Newbie Poster
MohitManocha is offline Offline
4 posts
since Mar 2005
Oct 1st, 2008
-1

Re: I want to manipulate the registry key values through a vb.net application

Hi Guys

I have managed to write values to a Windows Mobile CE Registry Editor from my application.

I have a writeIniReg() and a readIniReg() function

So, when the user enters their name in the textbox on the form it is written to the registry and read from it again the next time the user runs the program.

But my problem is that my readIniReg() gets a NullReferenceException when the program first loads .... but if I comment out the readIniReg() and run it to write data to the registry then uncomment the code, it can read from it...


Can anyone help me to check in my readIniReg() if the subKey folders exist first and create them if they dont exist ... so that I can get away from my error message.

Please even give some suggestions ... I still have a lot to learn with VB

VB.NET Syntax (Toggle Plain Text)
  1. Public Function readIniReg() As Boolean
  2. Dim localResult As Boolean
  3. Dim regKey As RegistryKey
  4. Dim regKeyCompany As RegistryKey
  5. Dim regKeyProduct As RegistryKey
  6.  
  7. localResult = False
  8.  
  9. regKey = Registry.CurrentUser.OpenSubKey("Software", True)
  10. regKeyCompany = regKey.OpenSubKey("Company", True)
  11. regKeyProduct = regKeyCompany.OpenSubKey("Data", True)
  12.  
  13. 'Name of value to return
  14. strName = regKeyProduct.GetValue("Username").ToString()
  15. 'Pass username string variable to form1 variable
  16. Form1_LogIn.username = strName
  17. 'Display Name in the textbox
  18. Form1_LogIn.txt_user.Text = strName
  19.  
  20.  
  21. 'Close all keys
  22. regKeyCompany.Close()
  23. regKeyProduct.Close()
  24. regKey.Close()

Regards

Elmo
Reputation Points: 30
Solved Threads: 0
Junior Poster in Training
Elmo_loves_you is offline Offline
85 posts
since Mar 2008
Mar 21st, 2009
-1

Re: I want to manipulate the registry key values through a vb.net application

how to create register in vb.net or asp.net?
Reputation Points: 8
Solved Threads: 0
Newbie Poster
manikandan_n84 is offline Offline
2 posts
since Mar 2009
Apr 5th, 2009
0

i want to add button on each google result search usig vb.net can any budy help me ou

Hi frnd i want to crate tool with add button on IE on each google search resulte using registry key or dom objects can any budy help me out
Reputation Points: 10
Solved Threads: 0
Newbie Poster
pratik30.ei is offline Offline
1 posts
since Apr 2009

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in VB.NET Forum Timeline: Problem with Picture Box resizing
Next Thread in VB.NET Forum Timeline: Update query not working in VB.NET





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC