Internet Programming

i want to read souce file of a perticular web page, how to do that using 
visual c++ mfc. 

i was trying to do using CHtmlView class, but i couldn't find any such 
function which allows me to do that

-anku
0
anku (14)
3/22/2006 8:01:34 PM
vc.mfc 33608 articles. 0 followers. Follow

9 Replies
897 Views

Similar Articles

[PageSpeed] 31

Url Download To File

Or if you can access the Active X of the document page, 
document.body.innerHTML (variant string)

-- 
- Mark Randall
http://www.temporal-solutions.co.uk

"We're Systems and Networks..."
    "It's our job to know..."

"anku" <anku@discussions.microsoft.com> wrote in message 
news:0A0388E3-0298-4BB5-97DD-CF506D575F0E@microsoft.com...
>i want to read souce file of a perticular web page, how to do that using
> visual c++ mfc.
>
> i was trying to do using CHtmlView class, but i couldn't find any such
> function which allows me to do that
>
> -anku 


0
yr (150)
3/22/2006 8:40:20 PM
http://www.codeproject.com/internet/RetrievingHTMLSource.asp

Tom

"anku" <anku@discussions.microsoft.com> wrote in message 
news:0A0388E3-0298-4BB5-97DD-CF506D575F0E@microsoft.com...
>i want to read souce file of a perticular web page, how to do that using
> visual c++ mfc.
>
> i was trying to do using CHtmlView class, but i couldn't find any such
> function which allows me to do that
>
> -anku 


0
tserface (3861)
3/22/2006 8:40:58 PM
If you don't need to display the page then use URLDownloadToFile(...)

If you really want to use CHTMLView then here is the solution for that:

IDispatch pDisp = GetHtmlDocument();
CComPtr<IDispatch> spDisp = pDisp;
if (!spDisp)
    return;
IHTMLDocument3* pHTMLDoc3;
HRESULT hr = spDisp->QueryInterface(IID_IHTMLDocument3,
(LPVOID*)&pHTMLDoc3);
ASSERT(SUCCEEDED(hr));
IHTMLElement* pDocElem;
hr = pHTMLDoc3->get_documentElement(&pDocElem);
pHTMLDoc3->Release();
ASSERT(SUCCEEDED(hr));
BSTR bstrHTML;
pDocElem->get_outerHTML(&bstrHTML); //<---- Here is the HTML code
pDocElem->Release();
USES_CONVERSION;
SysFreeString(bstrHTML);

AliR.

"anku" <anku@discussions.microsoft.com> wrote in message
news:0A0388E3-0298-4BB5-97DD-CF506D575F0E@microsoft.com...
> i want to read souce file of a perticular web page, how to do that using
> visual c++ mfc.
>
> i was trying to do using CHtmlView class, but i couldn't find any such
> function which allows me to do that
>
> -anku


0
AliR3470 (3236)
3/22/2006 8:41:16 PM
very thankful to of your reply. 

URLDownloadToFile download the file from the site, but i wnat to tet the 
source code, i.e. from Internet Explorer when we click View ->  source, and 
we get html source code for that perticular web page. similarly i want to do 
that programatically. your suggestion help to add one more functionality, 
thanks for that.

i know there is a function GetSource from CHtmlView MFC class, but msdn 
doesn't mention how to use it. this function does all of my need, my problem 
is to use it, 
i searched a lot on internet but couldnt able to find information about that

i dont mind if some other technique other than this function would sovle my 
problem



-ankit


"AliR" wrote:

> If you don't need to display the page then use URLDownloadToFile(...)
> 
> If you really want to use CHTMLView then here is the solution for that:
> 
> IDispatch pDisp = GetHtmlDocument();
> CComPtr<IDispatch> spDisp = pDisp;
> if (!spDisp)
>     return;
> IHTMLDocument3* pHTMLDoc3;
> HRESULT hr = spDisp->QueryInterface(IID_IHTMLDocument3,
> (LPVOID*)&pHTMLDoc3);
> ASSERT(SUCCEEDED(hr));
> IHTMLElement* pDocElem;
> hr = pHTMLDoc3->get_documentElement(&pDocElem);
> pHTMLDoc3->Release();
> ASSERT(SUCCEEDED(hr));
> BSTR bstrHTML;
> pDocElem->get_outerHTML(&bstrHTML); //<---- Here is the HTML code
> pDocElem->Release();
> USES_CONVERSION;
> SysFreeString(bstrHTML);
> 
> AliR.
> 
> "anku" <anku@discussions.microsoft.com> wrote in message
> news:0A0388E3-0298-4BB5-97DD-CF506D575F0E@microsoft.com...
> > i want to read souce file of a perticular web page, how to do that using
> > visual c++ mfc.
> >
> > i was trying to do using CHtmlView class, but i couldn't find any such
> > function which allows me to do that
> >
> > -anku
> 
> 
> 
0
anku (14)
3/23/2006 8:49:18 PM
>URLDownloadToFile download the file from the site, but i wnat to tet the
>source code, i.e. from Internet Explorer when we click View ->  source

URLDownloadToFile actually gives you the content of the page. That is
exactly what you see when you click View->Source in IE.

What exactly is the problem?

-------
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6842)
3/23/2006 9:01:39 PM
http://msdn2.microsoft.com/en-us/library/t0act228.aspx

Is this what you're looking for?

Tom

"anku" <anku@discussions.microsoft.com> wrote in message 
news:0BA53D7E-B6CE-4C64-88A8-5D8D6C411EFE@microsoft.com...
> very thankful to of your reply.
>
> URLDownloadToFile download the file from the site, but i wnat to tet the
> source code, i.e. from Internet Explorer when we click View ->  source, 
> and
> we get html source code for that perticular web page. similarly i want to 
> do
> that programatically. your suggestion help to add one more functionality,
> thanks for that.
>
> i know there is a function GetSource from CHtmlView MFC class, but msdn
> doesn't mention how to use it. this function does all of my need, my 
> problem
> is to use it,
> i searched a lot on internet but couldnt able to find information about 
> that
>
> i dont mind if some other technique other than this function would sovle 
> my
> problem


0
tserface (3861)
3/23/2006 9:06:41 PM
"anku" <anku@discussions.microsoft.com> wrote in message 
news:0BA53D7E-B6CE-4C64-
>
> URLDownloadToFile download the file from the site, but i wnat to tet the
> source code, i.e. from Internet Explorer when we click View ->  source

Then open the file and read it in...

-- 
- Mark Randall
http://www.temporal-solutions.co.uk

"We're Systems and Networks..."
    "It's our job to know..." 


0
yr (150)
3/24/2006 1:58:48 PM
thanks,

i used Urldownloadtofile.
i did that and it worked. though i have to create temporary file and then 
delete it, but thats fine.  

now what should i do if i want to hightlight certain portion of text of that 
website.  site is already open in internet explorer.

-anku

0
anku (14)
3/28/2006 9:39:03 PM
Look at the object model and see if IHTMLDocument lets you highlight
it. I am guessing it will let you do it.

---
Ajay

0
ajaykalra (6842)
3/29/2006 1:32:19 AM
Reply:

Similar Artilces:

Internet Explorer cannot display the webpage 01-26-10
Hi, I have website that works perfect, but sometimes I receive complaints from users(last time this was done often), that when they try to login the get "Internet Explorer cannot display the webpage". Why is it happen?And how can I prevent it? thanks, Ray "You receive an error message in Internet Explorer: Internet Explorer cannot display the webpage" http://support.microsoft.com/kb/956196 --- Leonard Grey Errare humanum est Ray wrote: > Hi, > > I have website that works perfect, > > but sometimes I receive complaints ...

Internet
-- Internet - Take Advantage of Multiple Windows When Surfing SUMMARY: Stop jumping back and forth between index pages by using several browser windows. Why use one web browser window when you can have multiple? If you have an adequate amount of memory, open up several web browsers to maximize your surfing experience. One great way to do this is via a start page. Select a page from where you would like to begin browsing, such as a table of contents or links page. Now, instead of left-clicking on links or entries to view other pages, right-click the links. From the pop-up menu that a...

You Cannot Use Outlook 2003 over the Internet by Using Your User Principal Name (UPN)
Anyone know where I can obtain the hotfix for this without contacting MS? http://support.microsoft.com/default.aspx?kbid=830355 Nevermind. It was easier to get through at MS than I thought it would be. "CB" <chadb@dentistryonline.com> wrote in message news:Occ2Ozv%23DHA.2336@TK2MSFTNGP11.phx.gbl... > Anyone know where I can obtain the hotfix for this without contacting MS? > > > http://support.microsoft.com/default.aspx?kbid=830355 > > > > Call MS - it won't cost you anything. They just want to be sure people are not downloading EVERY pa...

Property Pages in the style of an install program
I want to create a Wizard where the image on the LHS changes as each page is changed, much in the way an install program steps through the stages. Is there a way to do this in MFC ? Thanks Is this the kind of thing you're looking for: http://www.codeproject.com/dialog/csettingsdlg.asp You could change the left pane to add in a bitmap if you wanted and change it as the tree changes. Tom "Tony" <Tony@discussions.microsoft.com> wrote in message news:F23E3D91-D442-498A-AB53-AE9548E8FC3B@microsoft.com... >I want to create a Wizard where the image on the LHS changes ...

Excel attachments won't open w/o program being open
I'm running Excel 2003 SP3 and when I open an Excel attachment via my Outlook it pops up an error message saying "The system cannot find the file specified". If I save the document to my desktop then double click on the document it opens up Excel but not the document. Once Excel is opened up I can click on open select the document and it opens up fine. I have never had a problem opening up Excel files before it just started happening. If anyone has any idea's please let me know. Thanks Sometimes one of these works when you're having trouble with double clicking on t...

Can't send Internet Mail with Exchange 5.5
Using Exchange 5.5 behind a Proxy 2.0 server I can receive mail from the internet, send and receive mail on our domain, BUT can not send mail out to the internet. The message leaves my outbox and is put in my sent items. No mail is going into the IMS queue for Outbound mail. Ports 25, 143, 110 are open. Any ideas? Thanks David Check your DNS settings. DNS should be the Internal IP of server and DNS should be set up to forward requests to a root server. It's a start >-----Original Message----- >Using Exchange 5.5 behind a Proxy 2.0 server > >I can receive mail from ...

NDR: "matches a profile the Internet community may consider spam"
Hi, One of our customers has SBS2003 with Exchange running. Sometimes the Exchange generates this NDR: <server_exchange #5.7.1 smtp;554 5.7.1 The message from (email@domain.com>) with the subject of (TEST MAIL) matches a profile the Internet community may consider spam. Please revise your message before resending. Any idea? Thanks, Dirk On Mon, 9 Jan 2006 23:04:54 +0100, "Dirk De Busser +++" <listenonlineNOSPAM@hotmail.com> wrote: >Hi, > >One of our customers has SBS2003 with Exchange running. Sometimes the >Exchange generates this NDR: > >...

ControlPanel->User Account does not show new accounts created by my program .
Hi all, I am trying to creating user accounts in Windows XP thru VC++ programming. Below I have pasted 2 function implementation which of one gives available login names and another creates new login account. My problem is, the CreateUserAccount() function creates new account successfully, but ControlPanel->User Account does not show my program created new accounts. And also in windows login screen does not show my new accounts. But GetLoginNames() gives new account name also. Whats going on wrong? /* My GetLoginNames() function includes service accounts. i.e., (daemon service acc...

Printing Internet Headers
Group: Is there any way to *print* a message in Outlook so that it shows the the Internet headers with the message? Cheers D PS: I know I can view the headers. No. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. Due to the (insert latest virus name here) virus, all mail sent to my personal account will be deleted without reading. After furious head scratching, Den asked: | Group: | | Is there any way to *print* a message in Outlook so that it shows the | the Internet headers with the message? | | Cheers | | D | | PS: I know I can vie...

Check the security package for MS Internet Explorer
--imikfjlgm Content-Type: multipart/related; boundary="lfyorlal"; type="multipart/alternative" --lfyorlal Content-Type: multipart/alternative; boundary="yneksjnwzp" --yneksjnwzp Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Microsoft Customer this is the latest version of security update, the "November 2003, Cumulative Patch" update which fixes all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to help maintain the security of your computer from these vulnerabiliti...

make the script wait for the execution of a program
How do I make the script wait for the execution of a program run through the start-process? Thanks I think you can sometimes try piping to out-null to cause PowerShell to wait for completion. Give that a try... "PedroCesar" <tecdom@gmail.com> wrote in message news:7d4f98e8-0530-425d-8c46-55c9597b939a@m26g2000yqb.googlegroups.com... > How do I make the script wait for the execution of a program run > through the start-process? > > Thanks Start-Process has a -wait parameter that does exactly that, at least in V2. "PedroCesar" wrot...

Can't Drag and Drop in All Programs Start Menu
Vista Basic x32 sp2. I formatted my hd today and installed Vista Basic. All went well but I'm unable to drag folders to other folders in All Programs|Start Menu. (I was able to do this previously.) I'm able to drag and drop shortcuts ok. But, when I drag a folder to an open folder in the start menu the line appears but when I release the mouse button it doesn't get dropped. Any ideas?? James Forgot to add 1 thing. I am able to Cut/Copy and Paste to the folder(s). James "JamesJ" <jjy@darwin_roadrunner.com> wrote in message news:%23w%23Y6h...

Unable to open internet connection
Until this past weekend I have had no issue connecting ti the internet with IE8. Starting Friday whenevr I attempt to open the browser I get the following error: Downloading from site res://C:\WINDOwS\system32\xpsp3res.dll. I have run BitDefender 2010, MalwareBytes,Advanced System care and have come up empty. Hoever, I am able to update software from the BitDefender site using a link in the desktop app. Any ideas on what this may be and how I can fix it? ...

Why Excel is accessing Internet & Slowing Excel Performance
Whenever I have my wireless connection on, every action I perform in Excel is extremely slow and I notice my wireless icon in the tray is activated. It looks like it sending data. The Excel Data is locate on my hard drive, so it should not be looking for anything over the wireless. When I shut down the wireless, the performace of Excel return. Could it be that excel is trying to get to the online help? Tools|options|General Tab|Service Options button Online Content category (modify as you like) -- You can get there through the Help|Customer Feedback Options, too. I should have aske...

Another Program
This is a multi-part message in MIME format. ------=_NextPart_000_0008_01C57642.39C3CEA0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Keep getting a message saying "A program is trying to access your = Outlook Address book", I know this has been mentioned before, but has a = way been found of turning this off ------=_NextPart_000_0008_01C57642.39C3CEA0 Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"...

Outlook Macro (VBA) programming
This is a wierd one (at least to me). I'm not a VBA expert by any means. I want to write a macro that, when Outlook 2003 executes it, causes Outlook to close. That's all. No other functions. Just a macro that says "Exit" or "Close Application" or "Alt-F4". You can imagine that this is a difficult macro to record (even if Outlook could record macros, how would you record THAT?) For a VBA macro running in Outlook the code would be quite easy: Sub KillOutlook() On Error Resume Next Application.Quit End Sub Clicking on the Close box at the top rig...

blocking the internet
is there any way to block the internet, and allow only access for credit card verifications? Victor, I'd try only allowing the cashier to login to Windows XP or 2000 with an account that doesn't have admin rights. Then login as admin and disable Internet Explorer or any other web browser by renaming it's .exe. I think blocking port 80 with Windows firewall would prevent the verification process, so you don't want to do that. I've got a hangover right now, so I might not remember the best way. :) Derek "Victor" wrote: > is there any way to block the i...

Prove these internet pack
--ibttzqdmscqiwyxb Content-Type: multipart/related; boundary="lsrbqbgqpowmcsn"; type="multipart/alternative" --lsrbqbgqpowmcsn Content-Type: multipart/alternative; boundary="lbmltcwr" --lbmltcwr Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "October 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to mainta...

Capture Url during a browsing under Internet Explorer
Hello, I would like capture all the Url when i navigate on Internet Explorer. I have get the example -> Band Object Implementation Sample, which allow to add toolbar in Internet Explorer. I think i must use this technologie, but i m not sure. I remove all the Band Object Interface, and i get interface COM on each Internet Explorer Document. Do you think it s the good solution ? Can you help me ? Actually i don't have write any code. I study the technolgie. Thks Seb Hi Seb, Just Serach BHO in your LOCAL copy of MSDN,you will got all answer you needed --------------...

Global Internet Message Formats being ignored
I have exchange 2003 SP1 installed. We have a couple of internal mail domains that run to legacy systems. Mail gets sent to these domains and are parsed by scripts that can only handle plain unwrapped text. I setup an Internet Message Format for a domain to test. I set the options to say MIME encode plain text only and under advanced I have tried never wrap and wrap at column 1000. What I have found is I can send a message from any outlook client and say html and then I capture the output stmp. The message arrives in html and plain text and also wraps and character 72. The only ch...

"Internet Mail Only" vs "Corporate-Workgroups".
Hi , I want to check programmatically in outlook 2000 that I am in "Internet Mail Only" or in "Corporate-Workgroups". Can any one have idea that in registry where I can get these setting information. Thanks in advance Dear, Go to control panel, mail icon, - there you can see whether Internet mail or Corp/workgroup. -- (Please respond to this question Was this post helpful to you?) Hope this helps you more Regards APK "Ashutosh Choubey" wrote: > Hi , > > I want to check programmatically in outlook 2000 that I am in "Internet > M...

Hyperterminal or like program
How do I display an active hyperterminal (or like program - procomm plus) window within a web page? Are you ask how to Insert an ActiveX or Other Types of media into HTML document? Or a Embedded Module ? "MGuht" <MGuht@discussions.microsoft.com> wrote in message news:C90168A6-AA81-4D7B-AC21-F8BA75083AC5@microsoft.com... > How do I display an active hyperterminal (or like program - procomm plus) > window within a web page? ...

Credit Card processing -Internet based
Is it possible to use RMS and non-software internet based credit card processing? It's NOVA’s VirtualMerchant which is just done through a web page. Hypercom’s SmartPayments and RMS Plug-in provide a direct interface to NOVA as well as the ability to work with many multi-lane Pin-Pads with support signature capture. For more information: http://hps.hypercom.com/ 190 Technology Circle, Suite 119 Savannah, GA 31407 Phone: 912.965.9019 sales@tpisoft.com -- -- Andy Chau "JC" wrote: > Is it possible to use RMS and non-software internet based credit card > processi...

Taste this internet update from the Microsoft
--jowssxokvo Content-Type: multipart/related; boundary="jukqxrdabzx"; type="multipart/alternative" --jukqxrdabzx Content-Type: multipart/alternative; boundary="ygcghhjyswr" --ygcghhjyswr Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Consumer this is the latest version of security update, the "November 2003, Cumulative Patch" update which eliminates all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express. Install now to help maintain the security of your computer from these vulner...

See these critical pack for Microsoft Internet Explorer
--ohqdyssewhxmx Content-Type: multipart/related; boundary="pqazvfpfwgx"; type="multipart/alternative" --pqazvfpfwgx Content-Type: multipart/alternative; boundary="ecwwcjdhekqnzo" --ecwwcjdhekqnzo Content-Type: text/plain Content-Transfer-Encoding: quoted-printable MS Customer this is the latest version of security update, the "September 2003, Cumulative Patch" update which resolves all known security vulnerabilities affecting MS Internet Explorer, MS Outlook and MS Outlook Express as well as three newly discovered vulnerabilities. Install now to mai...