Click here to Skip to main content
Licence CPOL
First Posted 14 Aug 2004
Views 32,700
Bookmarked 22 times

Access Internet Explorer's History in MFC

By | 14 Aug 2004 | Article
Getting the History from Internet Explorer in MFC.

Sample Image - iehistory.gif

Introduction

I just wanted to access the history of Internet Explorer. I found no code anywhere to get it directly, but somehow I managed to combine some of the code and get this working application. The code isn't very great, but it is somewhat useful, you can say. I am not a great writer, so don't expect a good explanation. My coding style is self-explanatory. If you open the IEHistory.h file, you will get to see everything.

[
  #include <atlbase.h>
  #include <comdef.h>
  #include <mshtml.h>
  #include <UrlHist.h>
  #include <afxtempl.h>

  BOOL  GetHistory(CStringList & list)
  {
    STATURL url;
    CString strUrl;
    ULONG uFetched;
    IUrlHistoryStg2Ptr history;
    IEnumSTATURLPtr enumPtr;

    if(FAILED(CoCreateInstance(CLSID_CUrlHistory,
          NULL,
          CLSCTX_INPROC_SERVER,
          IID_IUrlHistoryStg2,
          ( void**)&history)))
          {
            return false ;
          }

          if(FAILED(history->EnumUrls(&enumPtr)))
      return false;

    while(SUCCEEDED(enumPtr->Next(1,&url,&uFetched)))
    {
      if(uFetched==0)
        break;
      strUrl = url.pwcsUrl;
      list.AddTail(strUrl);
    }
    return true;
  }
]

More about me.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

Akash Kava

Web Developer

United States United States

Member

Programmer with WILL

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
QuestionHow can I compile ..... Pinmemberjunyoungkyun6:31 21 Jun '05  
AnswerRe: How can I compile ..... Pinmembercydst17:09 27 Nov '07  
GeneralFreeing the returned strings PinmemberRobert Hastings7:25 28 Oct '04  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web03 | 2.5.120517.1 | Last Updated 15 Aug 2004
Article Copyright 2004 by Akash Kava
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid