Does the text have seen the "Internet Express" "Internet Express Download All Links"? Want to implement him, we can do this: IE has a few useful interfaces, we can use him to extract all links to get all the links with htmldocument2, get the IHTMLELEMENTCOLLECTION interface, then get the IHTMLANChorElement, and the get_href of the IHTMLANChorElement interface It is what we want, through the loop acquisition, we can get all the links to the web page! {TCHAR HostName [2 * MAX_PATH]; CComPtr
// Get IHTMLElementCollection interfaces if (SUCCEEDED (pDoc2-> get_links (& pElementCol))) {// AfxMessageBox ( "IHTMLElementCollection"); long p = 0; if (SUCCEEDED (pElementCol-> get_length (& p))) if (p! = 0) {m_LINKSNUM = M_LINKSNUM P; Updatedata (false); for (long i = 0; i <= (p-1); i ) {bstr string; _variant_t index = i; if (successmeded (startcol-> item (INDEX, INDEX, & SPDISPATCH))) / / Find the IHTMLANChorElement interface if (SUCCEEDED (Spdispatch-> Queryinterface (IID_IHTMLANCHORELEINTERFACE (IID_IHTMLANCHORELENTERFACE (IID_IHTMLANCHORELEMENT, (Void **))) // Get Link PLOCT-> Get_href (& string); ZeromeMory (Hostname, 2 * max_path); lstrcpy (hostname, _bstr_t (string));
// inserted into the link list in m_LinksList.InsertItem (i, HostName); m_LinksList.SetCheck (i, TRUE); pLoct-> get_hostname (& String); ZeroMemory (HostName, 2 * MAX_PATH); lstrcpy (HostName, _bstr_t (String) ); If (lstrlen (hostname) {m_linkslist.setitemtext (i, 1, hostname); log (hostname); log ("/ r / n");}}}}}}}}}}}}}}}}}}} This program is in VC7 Compilation under WinXP, please see the source code in detail! Tanxin79@163.net, thank you reading, the article source code is as follows: http://www.vchelp.net/asp/ibr_upload/543.rar