Page 1 of 3

How to make your browser the default

Posted: Sun Apr 24, 2011 4:45 pm
by MrAksel
Just showing you how to make your own webbrowser the default one
Code: Select all
Dim Key As Microsoft.Win32.RegistryKey = Microsoft.Win32.Registry.CurrentUser.CreateSubKey("Software\Clients\StartmenuInternet", True) 'Creates or opens the registry key for the default browser with write access
Key.SetValue("", "BROWSER PATH") 'The path of your program
Key.Close() 'closes and flushes the key
Replace "BROWSER PATH" with the program that should be the default browser
Or:
Code: Select all
Microsoft.Win32.Registry.SetValue("HKEY_CURRENT_USER\Software\Clients\StartmenuInternet", "", "BROWSER PATH")

Re: How to make your browser the default

Posted: Sun Apr 24, 2011 6:31 pm
by Agust1337
I think this has already been posted here but it might of been a question, but good anyway cooll;

Re: How to make your browser the default

Posted: Sun Apr 24, 2011 7:32 pm
by Zulf
This gives me an idea..To make a registry tool. :D

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 6:54 am
by MrAksel
Agust1337 wrote:
I think this has already been posted here but it might of been a question, but good anyway cooll;
You're right, a question has been posted(same forum in uploading/downloading files) but I didn't figure out how to do it until now

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 8:53 am
by Codex
Thanks for the code, this one will be easier to find then the other one :)
But, how does the browser open the webpage after being opened as the default browser?.

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 1:13 pm
by mandai
You can get the URL from command line arguments.

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 1:51 pm
by Axel
That would be like this
Code: Select all
Dim args as [string]() = environment.GetCommandLineArgs()
webbrowser1.navigate(args(0))
if its using multiple arguments you would need to change 0 to whatever

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 2:17 pm
by Skillful
Nice little piece of code MrAksel! Useful for me!

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 2:28 pm
by Agust1337
What would be new is that if it would check if it was the default browser like Chrome, FireFox, IE etc... do

Re: How to make your browser the default

Posted: Mon Apr 25, 2011 3:41 pm
by Codex
Agust1337 wrote:
What would be new is that if it would check if it was the default browser like Chrome, FireFox, IE etc... do
Wouldn't be that hard to create, just read the reg. key