分类: C/C++
2008-02-18 15:58:39
Environment: VC6
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 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#include #include #include #include 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; } ]