2012-10-30 20 views

回答

0

尝试此片代码段:

public class InternetExplorer 
{ 
    // List of URL objects 
    public List<URL> URLs { get; set; } 
    public IEnumerable<URL> GetHistory() 
    { 
     // Initiate main object 
     UrlHistoryWrapperClass urlhistory = new UrlHistoryWrapperClass(); 

     // Enumerate URLs in History 
     UrlHistoryWrapperClass.STATURLEnumerator enumerator = 
     urlhistory.GetEnumerator(); 

     // Iterate through the enumeration 
     while (enumerator.MoveNext()) 
     { 
      // Obtain URL and Title 
      string url = enumerator.Current.URL.Replace('\'', ' '); 
      // In the title, eliminate single quotes to avoid confusion 
      string title = string.IsNullOrEmpty(enumerator.Current.Title) 
      ? enumerator.Current.Title.Replace('\'', ' ') : ""; 

      // Create new entry 
      URL U = new URL(url, title, "Internet Explorer"); 

      // Add entry to list 
      URLs.Add(U); 
     } 

     // Optional 
     enumerator.Reset(); 

     // Clear URL History 
     urlhistory.ClearHistory(); 

     return URLs; 
    } 
} 

参考文献:

  1. How to show Internet Explorer's History in a control?
  2. Get Web browser history in C#
  3. How to access Internet Explorer History in C#
  4. IE history in C#
+0

有什么办法让它在C++中? – foobar