zoukankan      html  css  js  c++  java
  • 用API获取IE缓存文件

    // using   system.runtime.interopservices;   
      [structlayout(layoutkind.sequential,   charset = charset.auto)]         
      
    public     struct    internet_cache_entry_info         
      
    {       
      
    public     int    dwstructsize;           
      
    public    intptr   lpszsourceurlname;           
      
    public    intptr   lpszlocalfilename;           
      
    public     int    cacheentrytype;           
      
    public     int    dwusecount;           
      
    public     int    dwhitrate;           
      
    public     int    dwsizelow;           
      
    public     int    dwsizehigh;           
      
    public    filetime   lastmodifiedtime;           
      
    public    filetime   expiretime;           
      
    public    filetime   lastaccesstime;           
      
    public    filetime   lastsynctime;           
      
    public    intptr   lpheaderinfo;           
      
    public     int    dwheaderinfosize;           
      
    public    intptr   lpszfileextension;           
      
    public     int    dwexemptdelta;         
      }
         
      [dllimport(
    " wininet.dll " ,   setlasterror = true ,   charset = charset.auto)]       
      
    public     static     extern    intptr   findfirsturlcacheentry([marshalas(unmanagedtype.lptstr)]    string    urlsearchpattern,   intptr   lpfirstcacheentryinfo,    ref     int    lpdwfirstcacheentryinfobuffersize);     
      [dllimport(
    " wininet.dll " ,   setlasterror = true ,   charset = charset.auto)]         
      
    public     static     extern     bool    geturlcacheentryinfo(       [marshalas(unmanagedtype.lptstr)]    string    lpszurlname,       intptr   lpcacheentryinfo,        ref     int    lpdwcacheentryinfobuffersize       );   
      
    public     static     string    getcatchfilename( string    url)   
      
    {   
      
    int    nneeded    =     0 ,   nbufsize;           
      intptr   buf;       
      findfirsturlcacheentry(   
    null ,   intptr.zero,    ref    nneeded   );     
      nbufsize   
    =    nneeded;         buf    =    marshal.allochglobal(   nbufsize   );           
      geturlcacheentryinfo(url,buf,
    ref    nneeded);       
      internet_cache_entry_info   cacheitem;   
      geturlcacheentryinfo(url,buf,
    ref    nneeded);   
      cacheitem   
    =    (internet_cache_entry_info)   marshal.ptrtostructure(   buf, typeof (internet_cache_entry_info)   );             
      
    string    res = marshal.ptrtostringauto(cacheitem.lpszlocalfilename);   
      
    return (res);   
      }

     
  • 相关阅读:
    HTML滚动时位置固定
    SQL Server 2008中的代码安全===主密钥
    细说SQL Server中的加密
    SQL Server中的加密
    jQuery跨域调用WebService
    js中的preventDefault与stopPropagation详解
    jQuery中return false,e.preventDefault(),e.stopPropagation()的区别
    Tinymce在ASP.NET中的使用方法
    JSON.stringify 语法实例讲解
    json转字符串 —— jsonObj.toJSONString()与JSON.stringify(jsonObj)json to string
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204972.html
Copyright © 2011-2022 走看看