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

     
  • 相关阅读:
    php学习推荐
    python 安装numpy报错
    PHP最基础
    php自定义错误函数
    phpMyAdmin安装
    php链接mysql提示:Call to undefined function mysql_connect()
    POJ 1005 解题报告
    亚马逊在线笔试(2014/10/9)
    LeetCode 题目 word break 思路剖析与改进
    Dijkstra单源最短路算法的C++实现
  • 原文地址:https://www.cnblogs.com/cl1024cl/p/6204972.html
Copyright © 2011-2022 走看看