我在FORM1里有个webbrowser 打开网页后 登陆账号密码  然后我打开 FORM2 里面的webbrowser还是打开刚那网页 我之前登陆的状态还在
但不知道怎么回事 这2天 打开FORM1里登陆后 打开FORM2里面是没登陆  这是什么原因 希望指点

解决方案 »

  1.   

    清除IE记录 unit   Unit1; interface uses 
        Windows,   Messages,   SysUtils,   Classes,   Graphics,   Controls,   Forms,   Dialogs, 
        StdCtrls,Registry,wininet,FileCtrl,shlobj,shellapi; type 
        TForm1   =   class(TForm) 
            Button1:   TButton; 
            procedure   Button1Click(Sender:   TObject); 
        private 
            {   Private   declarations   } 
        public 
            {   Public   declarations   } 
        end; var 
        Form1:   TForm1; implementation {$R   *.DFM} 
    procedure   DelRegCache; 
    var 
          reg:TRegistry; 
    begin 
          reg:=Tregistry.create; 
          reg.RootKey:=HKEY_CURRENT_USER; 
          reg.DeleteKey( 'Software\Microsoft\Internet   Explorer\TypedURLs '); 
          reg.Free; 
    end; function   GetCookiesFolder:string; 
    var 
            pidl:pItemIDList; 
            buffer:array   [   0..255   ]   of   char   ; 
    begin 
          SHGetSpecialFolderLocation( 
              application.Handle   ,   CSIDL_COOKIES,   pidl);       SHGetPathFromIDList(pidl,   buffer); 
          result:=strpas(buffer); 
    end; function   ShellDeleteFile(sFileName:   string):   Boolean; 
    var 
        FOS:   TSHFileOpStruct; 
    begin 
          FillChar(FOS,   SizeOf(FOS),   0);   {记录清零} 
          with   FOS   do 
          begin 
                  wFunc   :=   FO_DELETE;//删除 
                  pFrom   :=   PChar(sFileName); 
                  fFlags   :=   FOF_NOCONFIRMATION; 
          end; 
          Result   :=   (SHFileOperation(FOS)   =   0); 
    end; procedure   DelCookie; 
    var 
          dir:string; 
    begin 
          InternetSetOption(nil,   INTERNET_OPTION_END_BROWSER_SESSION,   nil,   0); 
          dir:=GetCookiesFolder; 
          ShellDeleteFile(dir+ '\*.txt '); 
    end; procedure   DelHistory; 
    var 
        lpEntryInfo:   PInternetCacheEntryInfo; 
        hCacheDir:   LongWord   ; 
        dwEntrySize,   dwLastError:   LongWord; 
    begin 
          dwEntrySize   :=   0; 
          FindFirstUrlCacheEntry(nil,   TInternetCacheEntryInfo(nil^),   dwEntrySize); 
          GetMem(lpEntryInfo,   dwEntrySize);       hCacheDir   :=   FindFirstUrlCacheEntry(nil,   lpEntryInfo^,   dwEntrySize); 
          if   hCacheDir   <>   0   then 
                DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName); 
          FreeMem(lpEntryInfo);       repeat 
              dwEntrySize   :=   0; 
              FindNextUrlCacheEntry(hCacheDir,   TInternetCacheEntryInfo(nil^), 
                  dwEntrySize); 
              dwLastError   :=   GetLastError(); 
              if   dwLastError   =   ERROR_INSUFFICIENT_BUFFER   then   //如果成功 
              begin 
                      GetMem(lpEntryInfo,   dwEntrySize);   {分配dwEntrySize字节的内存} 
                      if   FindNextUrlCacheEntry(hCacheDir,   lpEntryInfo^,   dwEntrySize)   then 
                            DeleteUrlCacheEntry(lpEntryInfo^.lpszSourceUrlName); 
                      FreeMem(lpEntryInfo); 
              end; 
        until   (dwLastError   =   ERROR_NO_MORE_ITEMS); 
    end; procedure   TForm1.Button1Click(Sender:   TObject); 
    begin 
        try 
            screen.cursor:=crHourGlass; 
            DelRegCache; 
            DelCookie; 
            DelHistory; 
        finally 
            screen.cursor:=crDefault; 
        end; 
    end; end.
      

  2.   

      这和webbrowser控件没什么关系。
      IE设置问题吧。你别用DELPHI程序开网页,直接换成IE,先登录一个。然后你再开个IE看一下嘛。
      
      

  3.   

    IE没问题的 就是我现在DELPHI 做了个程序 里面2个子FORM 之前没问题的 不知道怎么回事 我还特地重做了下系统 还是这样