我用IE的JAVASCRIPT调用我写的OCX.. 
然后OCX多线连接网络.线成结束前无法关闭IE 
怎么办.代码如下:
unit Unit1; {$WARN SYMBOL_PLATFORM OFF} interface uses 
  ComObj,Windows, ActiveX, Test_TLB, StdVcl, Registry, WinHTTP,Classes; type 
  TTestUrl = class(TAutoObject, ITestUrl, IObjectSafety) 
  protected 
    function Get_Url: WideString; safecall; 
    procedure Set_Url(const Value: WideString); safecall; 
    function Get_Html: WideString; safecall; 
    function Get_Referer: WideString; safecall; 
    procedure Set_Referer(const Value: WideString); safecall; 
    function Get_Version: WideString; safecall; 
    procedure WinHTTPDone(Sender: TObject; const ContentType: String; 
      FileSize: Integer; Stream: TStream); 
  public 
    function GetInterfaceSafetyOptions(const IID: TIID; pdwSupportedOptions,        //安全接口 
      pdwEnabledOptions: PDWORD): HResult; stdcall; 
    function SetInterfaceSafetyOptions(const IID: TIID; dwOptionSetMask, 
      dwEnabledOptions: DWORD): HResult; stdcall; 
  end; implementation uses ComServ; var 
  my_url:String; 
  my_referer:String; 
  my_html:String; 
procedure TTestUrl.WinHTTPDone(Sender: TObject; const ContentType: String; 
  FileSize: Integer; Stream: TStream); 
var 
  Str: String;  
begin 
  with Stream as TMemoryStream do 
  begin 
    SetLength(Str, Size); 
    Move(Memory^, Str[1], Size); 
    my_html := Str; 
  end; 
end; function TTestUrl.Get_Url: WideString; 
begin 
  Result := my_url; 
end; procedure TTestUrl.Set_Url(const Value: WideString); 
begin 
  my_url := Value; 
end; 
function TTestUrl.Get_Html: WideString; 
var 
  http:TWinHTTP; 
  reg:TRegistry; 
begin 
  http :=  TWinHTTP.Create(nil);//TWinHTTP.create(nil); 
  with http do try 
      OnDone := WinHTTPDone; 
      Referer := my_referer; 
      URL := my_url; 
      if Read(true) then 
      begin 
      Result:= my_html; 
      end; 
  finally 
      free; 
  end; end; function TTestUrl.GetInterfaceSafetyOptions(const IID: TIID; 
  pdwSupportedOptions, pdwEnabledOptions: PDWORD): HResult; 
var 
  Unk: IUnknown; 
begin 
  if (pdwSupportedOptions = nil) or (pdwEnabledOptions = nil) then 
  begin 
    Result := E_POINTER; 
    Exit; 
  end; 
  Result := QueryInterface(IID, Unk); 
  if Result = S_OK then 
  begin 
    pdwSupportedOptions^ := INTERFACESAFE_FOR_UNTRUSTED_CALLER or 
                                            INTERFACESAFE_FOR_UNTRUSTED_DATA; 
    pdwEnabledOptions^ := 
      INTERFACESAFE_FOR_UNTRUSTED_CALLER or INTERFACESAFE_FOR_UNTRUSTED_DATA; 
  end 
  else 
  begin 
    pdwSupportedOptions^ := 0; 
    pdwEnabledOptions^ := 0; 
  end; 
end; function TTestUrl.SetInterfaceSafetyOptions(const IID: TIID; 
  dwOptionSetMask, dwEnabledOptions: DWORD): HResult; 
var 
  Unk: IUnknown; 
begin 
  Result := QueryInterface(IID, Unk); 
  if Result <> S_OK then Exit; 
end; 
function TTestUrl.Get_Referer: WideString; 
begin 
      Result := my_referer; 
end; procedure TTestUrl.Set_Referer(const Value: WideString); 
begin 
      my_referer := Value; 
end; function TTestUrl.Get_Version: WideString; 
begin 
      Result := ''; 
end; 
initialization 
  TAutoObjectFactory.Create(ComServer, TTestUrl, Class_TestUrl, 
    ciMultiInstance, tmApartment); 
end.