Florian Leitgeb
Florian Leitgeb

Reputation: 16624

Change Standard Browser on Windows 7 programmatically

First of all I would need to set the right registry entry before I continue with the code snippet to change my registry entries.

I have tried all I found on internet, and that's why I post here now.

All registry entries are not working which are referred on MSDN. Also changing those won't work:

HKEY_CLASSES_ROOT\http\shell\open\command

HKEY_CLASSES_ROOT\.htm

HKEY_CLASSES_ROOT\.html

HKEY_CLASSES_ROOT\http\shell\open\command

HKEY_CLASSES_ROOT\http\shell\open\ddeexec\Application

HKEY_CLASSES_ROOT\ftp\shell\open\command

HKEY_CLASSES_ROOT\ftp\shell\open\ddeexec\Application

HKEY_CLASSES_ROOT\gopher\shell\open\command

HKEY_CLASSES_ROOT\gopher\shell\open\ddeexec\Application

HKEY_CURRENT_USER\SOFTWARE\Clients\StartMenuInternet

My registry shouldn't know anything about my Mozilla, because I entered my own coded browser at every entry.

Don't know what to do...

After getting the right entries I would use a code snippet like that to add and change the entries:

        RegistryKey myKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\\My Registry Key", true);

        myKey.SetValue("My String Value", "Test Value", RegistryValueKind.String);

        string myValue = (string)myKey.GetValue("My String Value");

Upvotes: 0

Views: 1334

Answers (2)

Mik
Mik

Reputation: 11

This is a Little bit late, maybe too late but others might benefit from my answer. The settings changed in the code above complies to Windows XP and not windows Vista or 7. To set default browser in Win Vista or 7, use CURRENT_USER registry entries. Cheers!

Upvotes: 1

Stefan Steiger
Stefan Steiger

Reputation: 82186

You could use a sysinternals tool (i forgot the name) that takes a process and records all api and registry activity, and look how Google-Chrome does it.
Or you could directly look at the chromium sourcecode.

Or you could be lazy and just use google, wich would let you find this search result:
how do i change default browser using c# or batch file

Upvotes: 0

Related Questions