Click here to Skip to main content
16,006,001 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: how could I disable Escape the dialog Pin
Johan Rosengren7-Jun-04 19:27
Johan Rosengren7-Jun-04 19:27 
GeneralRe: how could I disable Escape the dialog Pin
lonely_life7-Jun-04 20:33
lonely_life7-Jun-04 20:33 
GeneralRe: how could I disable Escape the dialog Pin
Johan Rosengren7-Jun-04 20:51
Johan Rosengren7-Jun-04 20:51 
GeneralRe: how could I disable Escape the dialog Pin
lonely_life7-Jun-04 21:16
lonely_life7-Jun-04 21:16 
GeneralProblm in CoInitializeEx( .. , .. ) Pin
Zeeshan Bilal7-Jun-04 19:07
Zeeshan Bilal7-Jun-04 19:07 
GeneralRe: Problm in CoInitializeEx( .. , .. ) Pin
valikac7-Jun-04 20:07
valikac7-Jun-04 20:07 
GeneralCHtmlView - getting the html contents off a webpage to process Pin
testtests7-Jun-04 18:51
testtests7-Jun-04 18:51 
GeneralRe: CHtmlView - getting the html contents off a webpage to process Pin
Andrew Quinn AUS7-Jun-04 22:04
Andrew Quinn AUS7-Jun-04 22:04 
Hi there,

Firstly, override the OnDocumentComplete virtual function (event), then we can get access to the DOM, e.g.

virtual void OnDocumentComplete(LPCTSTR lpszURL);


void CMyHTMLView::OnDocumentComplete(LPCTSTR lpszURL) 
{
	USES_CONVERSION;

	// This example will look for an element on the HTML page that has an id of 'idDataCell1'
	// if found, the text (value) inside this element is retrieved for you to process...
	MSHTML::IHTMLDocument2Ptr spDoc(this->GetHtmlDocument());
	if (spDoc)
	{
		MSHTML::IHTMLDocument3Ptr spDoc3 = spDoc;
		if (spDoc3)
		{
			MSHTML::IHTMLElementPtr spElem = spDoc3->getElementById(_bstr_t("idDataCell1"));
			if (spElem)
			{
				CString strValue = W2T(spElem->innerText);
			}
		}
	}
	CHtmlView::OnDocumentComplete(lpszURL);
}


With the above code, remember to import the MSHTML type library to help give us smart pointer wrappers around the interfaces, e.g. insert into your views .h file

#import <mshtml.tlb>  no_auto_exclude


Also, we use are performing unicode conversion here (macros USES_CONVERSION and W2T) so dont forget to add:
#include <AFXPRIV.H>

into your stdafx.h file.

I've assumed that the document returned has tags labelled with ID's - if this isn't how the data is 'structured' then you need to give me an example of the HTML. We can use the DOM to recurse through the hierarchy to retrieve the information you want. I must point out though, if you can use ID's then this is the preferred approach.

Hope this helps,
Andy
GeneralRe: CHtmlView - getting the html contents off a webpage to process Pin
testtests7-Jun-04 22:48
testtests7-Jun-04 22:48 
GeneralRe: CHtmlView - getting the html contents off a webpage to process Pin
Andrew Quinn AUS7-Jun-04 23:07
Andrew Quinn AUS7-Jun-04 23:07 
GeneralRe: CHtmlView - getting the html contents off a webpage to process Pin
testtests7-Jun-04 23:21
testtests7-Jun-04 23:21 
GeneralRe: CHtmlView - getting the html contents off a webpage to process Pin
Andrew Quinn AUS8-Jun-04 0:09
Andrew Quinn AUS8-Jun-04 0:09 
GeneralRe: CHtmlView - getting the html contents off a webpage to process Pin
testtests8-Jun-04 4:26
testtests8-Jun-04 4:26 
GeneralI want to use Installshield ?? HOW Pin
Zeeshan Bilal7-Jun-04 18:37
Zeeshan Bilal7-Jun-04 18:37 
GeneralRe: I want to use Installshield ?? HOW Pin
Vadim Tabakman7-Jun-04 18:40
Vadim Tabakman7-Jun-04 18:40 
GeneralRe: I want to use Installshield ?? HOW Pin
Zeeshan Bilal7-Jun-04 18:59
Zeeshan Bilal7-Jun-04 18:59 
GeneralRe: I want to use Installshield ?? HOW Pin
Vadim Tabakman7-Jun-04 19:25
Vadim Tabakman7-Jun-04 19:25 
GeneralRe: I want to use Installshield ?? HOW Pin
PJ Arends7-Jun-04 19:43
professionalPJ Arends7-Jun-04 19:43 
QuestionHow to use vc6 + directx8? Pin
chenbuaa7-Jun-04 17:08
chenbuaa7-Jun-04 17:08 
AnswerRe: How to use vc6 + directx8? Pin
Zeeshan Bilal7-Jun-04 18:35
Zeeshan Bilal7-Jun-04 18:35 
GeneralRe: How to use vc6 + directx8? Pin
Vadim Tabakman7-Jun-04 18:38
Vadim Tabakman7-Jun-04 18:38 
AnswerRe: How to use vc6 + directx8? Pin
Vadim Tabakman7-Jun-04 18:37
Vadim Tabakman7-Jun-04 18:37 
Generaltext drawn with CPaintDC::DrawText disappears!!! Pin
kfaday7-Jun-04 16:47
kfaday7-Jun-04 16:47 
GeneralRe: text drawn with CPaintDC::DrawText disappears!!! Pin
Johan Rosengren7-Jun-04 19:43
Johan Rosengren7-Jun-04 19:43 
GeneralRe: text drawn with CPaintDC::DrawText disappears!!! Pin
kfaday8-Jun-04 2:19
kfaday8-Jun-04 2:19 

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

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