//获取默认internet浏览器 function GetDefaultShellHTTP: string; var Reg: TRegistry; strWord: string; begin strWord := ''; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; if Reg.KeyExists('http\shell\open\command') then begin Reg.OpenKey('http\shell\open\command',false); strWord := Reg.ReadString(''); Reg.CloseKey; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; if Reg.KeyExists('htmlfile\shell\open\command') then begin Reg.OpenKey('htmlfile\shell\open\command',false); strWord := strWord + ',' + Reg.ReadString(''); Reg.CloseKey; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; if Reg.KeyExists('mhtmlfile\shell\open\command') then begin Reg.OpenKey('mhtmlfile\shell\open\command',false); strWord := strWord + ',' + Reg.ReadString(''); Reg.CloseKey; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; if Reg.KeyExists('InternetShortcut\shell\open\command') then begin Reg.OpenKey('InternetShortcut\shell\open\command',false); strWord := strWord + ',' + Reg.ReadString(''); Reg.CloseKey; end; Reg.Free; Result := strWord; end; //设置自己的internet浏览器 function SetDefaultShellHttp(CmdLine: string): Boolean; var Reg: TRegistry; begin Result := False; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; //注册表的地址: if Reg.KeyExists('http\shell\open\command') then begin try Reg.OpenKey('http\shell\open\command', True);//注册表的地址: Reg.WriteString('', CmdLine); finally Reg.CloseKey; end; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; //注册表的地址: if Reg.KeyExists('htmlfile\shell\open\command') then begin try Reg.OpenKey('htmlfile\shell\open\command', True);//注册表的地址: Reg.WriteString('', CmdLine); finally Reg.CloseKey; end; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; //注册表的地址: if Reg.KeyExists('mhtmlfile\shell\open\command') then begin try Reg.OpenKey('mhtmlfile\shell\open\command', True);//注册表的地址: Reg.WriteString('', CmdLine); finally Reg.CloseKey; end; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CURRENT_USER; //注册表的地址: if Reg.KeyExists('\SOFTWARE\Clients\StartMenuInternet') then begin try Reg.OpenKey('\SOFTWARE\Clients\StartMenuInternet', True);//注册表的地址: Reg.WriteString('', Application.Title); finally Reg.CloseKey; end; end; Reg.Free; //以下是针对Windwos 7 以上的系统作出的方案 Reg := TRegistry.Create; Reg.RootKey := HKEY_CLASSES_ROOT; //注册表的地址: if Reg.KeyExists('\MicroblueWeb') then begin try Reg.OpenKey('\MicroblueWeb', True);//注册表的地址: if not Reg.KeyExists('shell\open\command') then begin Reg.CreateKey('shell\open\command'); end; Reg.OpenKey('shell\open\command', True);//注册表的地址: Reg.WriteString('', CmdLine); finally Reg.CloseKey; end; end else begin try Reg.CreateKey('MicroblueWeb'); Reg.OpenKey('\MicroblueWeb', True);//注册表的地址: Reg.CreateKey('shell\open\command'); Reg.OpenKey('shell\open\command', True); Reg.WriteString('', CmdLine); finally Reg.CloseKey; end; end; Reg.Free; Reg := TRegistry.Create; Reg.RootKey := HKEY_CURRENT_USER; //注册表的地址: if Reg.KeyExists('\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice') then begin try Reg.OpenKey('\Software\Microsoft\Windows\Shell\Associations\UrlAssociations\http\UserChoice', True);//注册表的地址: Reg.WriteString('Progid', 'MicroblueWeb'); finally Reg.CloseKey; end; end; Reg.Free; Result := True; end; //注册自己的浏览器 function RegeditWeb(CmdLine, Path: string): Boolean; var Reg: TRegistry; begin Result := False; Reg := TRegistry.Create; Reg.RootKey := HKEY_LOCAL_MACHINE; //注册表的地址: if Reg.KeyExists('\SOFTWARE\Clients\StartMenuInternet') then begin try Reg.OpenKey('\SOFTWARE\Clients\StartMenuInternet', True);//注册表的地址: if not Reg.KeyExists('\SOFTWARE\Clients\StartMenuInternet\' + CmdLine) then begin Reg.CreateKey(CmdLine); end; Reg.OpenKey(CmdLine, True);//注册表的地址: Reg.WriteString('', CmdLine); if not Reg.KeyExists(CmdLine + '\shell\open\command') then begin Reg.CreateKey('shell\open\command'); end; Reg.OpenKey('shell\open\command', True); Reg.WriteString('', Path); finally Reg.CloseKey; end; end; Reg.Free; Result := True; end;