[問題] 更改預設瀏覽器
我作業系統是Win7 (64位元)
網路上找的資訊都是說在以下的註冊表位置
HKEY_CLASSES_ROOT\http\shell\open\command
裡的value值設為
C:\Program Files\Internet Explorer\iexplore.exe
但我用Google瀏覽器跟IE交互設定預設瀏覽器
那value值也不會改變..(預設瀏覽器有變)
後來在HKEY_USERS\S-1-5-21-3076430924-96...(一長串)\...\.....
下發現有個值是存預設瀏覽器的名稱
會隨著改預設瀏覽器而跟著變
但搜尋Internet Explorer\iexplore.exe或Google的會搜出一大堆
不知道哪個才是存預設瀏覽器路徑....
請問有誰知道怎麼找到她存路徑的地方呢?
------------------------------------------------
以下是程式碼:
//判斷路徑上的Program Files是否要加"(x86)"
RegistryKey key = Registry.LocalMachine.OpenSubKey("HARDWARE\\DESCRIPTION\\System\\CentralProcessor\\0");
string CPUTag = key.GetValue("Identifier").ToString();
string mainKey = @"http\shell\open\command"; //預設瀏覽器路徑的註冊位置
string nameKey = @"http\shell\open\ddeexec\Application"; //預設瀏覽器名稱的註冊位置
string IEPath;
if(CPUTag.Substring(5,2)=="64")
IEPath = @"C:\Program Files (x86)\Internet Explorer\iexplore.exe";
else
IEPath = @"C:\Program Files\Internet Explorer\iexplore.exe";
bool result = false;
try
{
string value = string.Format("\"{0}\" -- \"%1\"", IEPath);
RegistryKey regKey = Registry.ClassesRoot.OpenSubKey(mainKey, true);
regKey.SetValue("", value);
regKey.Close();
regKey = Registry.ClassesRoot.OpenSubKey(nameKey, true);
regKey.SetValue("", "IExplore");
regKey.Close();
result = true;
MessageBox.Show("預設瀏覽器已設為IE瀏覽器!","設定");
}
catch
{
MessageBox.Show("設定預設瀏覽器失敗。!", "設定");
}
return result;
--
This is SPARTA!
我只是要土和水
拿來種種花啊!!! \固
囧//☆︿異╲
█ ☆ \ by aokman
████████◤ \\ ◥██aokman███████████████
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 60.248.105.178
→
04/09 19:15, , 1F
04/09 19:15, 1F
討論串 (同標題文章)
C_Sharp 近期熱門文章
PTT數位生活區 即時熱門文章
52
79