• 用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);   
      }

     
  • 相关阅读:
    ACM 一种排序
    ACM Binary String Matching
    ACM 括号配对问题
    ACM BUYING FEED
    ACM 喷水装置(二)
    ACM 会场安排问题
    ACM 推桌子
    ACM 心急的C小加
    ACM 田忌赛马
    ACM 疯牛
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204972.html
Copyright © 2020-2023  润新知