程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> .NET網頁編程 >> ASP.NET >> 關於ASP.NET >> 用API獲取IE緩存文件

用API獲取IE緩存文件

編輯:關於ASP.NET
//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); 
 }
  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved