我用delphi编了一个简易的web浏览器,请问怎么加入代码把他设置成windows的默认浏览器啊,急需解决方案啊,谢谢各位了

解决方案 »

  1.   

    每次启动的时候检查注册表,如果默认的浏览器不是自己的话,就修改为自己的程序。
    注册表路径:HKEY_CLASSES_ROOT\http\shell\open\command
      

  2.   

    直接修改注册表HKEY_CLASSES_ROOT\htmlfile\shell\open\command键值
      

  3.   

    下面的函数是通过读取注册表的设置后,得到默认Internet的浏览器所在地址
    uses
      Registry;
    function GetDefaultShellHTTP : string;
    var
    reg : TRegistry;
    begin
      Reg:=TRegistry.Create;
      Reg.RootKey:=HKEY_CLASSES_ROOT;
      if Reg.KeyExists('http\shell\open\command') then
      begin
        Reg.OpenKey('http\shell\open\command',false);
        Result:=Reg.ReadString('');
      end
      else
        Result:='';
      Reg.Free;
    end;设置internet浏览器
    procedure SetDefaultShellHttp(CmdLine : string);
    var
    reg : TRegistry;
    begin
      Reg:=TRegistry.Create;
      Reg.RootKey:=HKEY_CLASSES_ROOT; //注册表的地址:
      Reg.OpenKey('http\shell\open\command',true);//注册表的地址:
      Reg.WriteString('',CmdLine);
      Reg.Free;
    end;setDefaultshellhttp('"C:\PROGRA~1\INTERN~1\iexplorer.exe" -nohome');