怎么用程序修改ie的安全性设置和怎么检测ie的收藏夹的内容和历史记录的内容。

解决方案 »

  1.   

    查看IE历史记录
    --------------------
    (转)
    -----------------------
    procedure TForm1.Button4Click(Sender: TObject);
    var
      FirstCacheHandle: THandle;
      PFirstCacheEntryInfo,PNextCacheEntryInfo: PInternetCacheEntryInfoA;
      FirstCacheEntryInfo,NextCacheEntryInfo: TInternetCacheEntryInfoA;
      FirstCacheEntryInfoBufferSize,NextCacheEntryInfoBufferSize: Dword;
      HaveItem :Boolean;
    begin
      HaveItem := True;
      FirstCacheEntryInfoBufferSize := 0;
      NextCacheEntryInfoBufferSize := 0;
      FirstCacheEntryInfo.dwStructSize := FirstCacheEntryInfoBufferSize;
      NextCacheEntryInfo.dwStructSize := NextCacheEntryInfoBufferSize;
      GetMem(PFirstCacheEntryInfo,sizeof(TInternetCacheEntryInfoA));
      GetMem(PNextCacheEntryInfo,sizeof(TInternetCacheEntryInfoA));
      //Dispose(PNextCacheEntryInfo);
      PFirstCacheEntryInfo^.dwStructSize := sizeof(TInternetCacheEntryInfoA);
      PNextCacheEntryInfo^.dwStructSize := sizeof(TInternetCacheEntryInfoA);
      FirstCacheHandle := 0;
      while FirstCacheHandle=0 do
        begin
          FirstCacheHandle :=FindFirstUrlCacheEntryEx
            ('',0,URLCACHE_FIND_DEFAULT_FILTER
            ,0,PFirstCacheEntryInfo,@FirstCacheEntryInfoBufferSize,nil,nil,nil);
          if FirstCacheHandle =0 then
          begin
            //Freemem(PFirstCacheEntryInfo);
            case GetLastError of
            ERROR_NO_MORE_ITEMS :
              begin
                FindCloseUrlCache(FirstCacheHandle);
                FreeMem(PFirstCacheEntryInfo);
                Break;
              end;
            ERROR_INSUFFICIENT_BUFFER :
              begin
              FreeMem(PFirstCacheEntryInfo);
              GetMem(PFirstCacheEntryInfo,FirstCacheEntryInfoBufferSize);
              PFirstCacheEntryInfo^.dwStructSize := FirstCacheEntryInfoBufferSize;
              continue;
              end;
            else
              begin
              showmessage('Can not Press Cache!');
              Break;
              end;
            end;
          end;
        end ;
      try
      while HaveItem=true do
      begin
        if not (FindNextUrlCacheEntryEx(FirstCacheHandle,PNextCacheEntryInfo,
        @NextCacheEntryInfoBufferSize,nil,nil,nil)) then
        begin
          //FreeMem(PNextCacheEntryInfo);
          case GetLastError of
            ERROR_NO_MORE_ITEMS :
              begin
              FindCloseUrlCache(FirstCacheHandle);
              HaveItem :=false;
              continue;
              end;
            ERROR_INSUFFICIENT_BUFFER :
              begin
              FreeMem(PNextCacheEntryInfo);
              GetMem(PNextCacheEntryInfo,NextCacheEntryInfoBufferSize);
              PNextCacheEntryInfo^.dwStructSize := NextCacheEntryInfoBufferSize;
              continue;
              end;
          else
            begin
              FreeMem(PNextCacheEntryInfo);
              showmessage('Error');
              Break;
            end;
          end;
        end
        else
          begin
          Listbox1.items.add(strpas(PNextCacheEntryInfo^.lpszSourceUrlName));
          Listbox2.items.add(strpas(PNextCacheEntryInfo^.lpszLocalFileName));
          end;
      end;
      except
      end;
      //freemem(PFirstCacheEntryInfo);
      //freemem(PNextCacheEntryInfo);
      //Dispose(PFirstCacheEntryInfo);
    end;
      

  2.   

    收藏夹
    ---------------------
    Dll 文件:shdocvw.dll
    procedure DoOrganizeFavDlg(h:hwnd;path:pchar);stdcall;external 'shdocvw.dll';
    第二个参数指定收藏夹的位置,如果第二个参数为Nil的话,默认IE得收藏夹位置。
    AddUrlToFavorites
    DoAddToFavDlg
    DoAddToFavDlgW
    DoFileDownload
    DoFileDownloadEx
    DoOrganizeFavDlgW
    SHAddSubscribeFavorite
    SetShellOfflineState
    SoftwareUpdateMessageBox
    //添加到收藏夹
    const
      CLSID_ShellUIHelper: TGUID = '{64AB4BB7-111E-11D1-8F79-00C04FC2FBE1}';
    var 
      ShellUIHelper: ISHellUIHelper; 
      url, title: Olevariant; 
    begin
      url:='www.csdn.net'
      title:='中国软件'
      ShellUIHelper :=CreateComObject(CLSID_SHELLUIHELPER) as IShellUIHelper;
      ShellUIHelper.AddFavorite(url, title);
    end;
    //整理收藏
    var
      H: HWnd;
      p: procedure(Handle: THandle; Path: PChar); stdcall;
    begin
            H := LoadLibrary(PChar('shdocvw.dll'));
            if H <> 0 then
              begin
                p := GetProcAddress(H, PChar('DoOrganizeFavDlg'));
                if Assigned(p) then p(Application.Handle, PChar(favpath));
              end;
          FreeLibrary(h); 
    end;
    ---------
    导出收藏夹
    在VB中选择菜单的Project | References 选项,在References对话框中选择Microsoft Internet Controls项,然后在程序中加入以下语句:Dim dc As New SHDocVw.ShellUIHelperdc.ImportExportFavorites False, "c:\a.html"
    Set dc = Nothing
    就可以将收藏夹导出到 c:\a.htm 中了,如果要从文件导入到收藏夹,只要将上面的False改为True,将"c:\a.html"改为要导入的文件名就可以了。
      

  3.   

    编译时说没有PInternetCacheEntryInfoA数据类型啊