Click here to Skip to main content
15,903,012 members
Home / Discussions / ATL / WTL / STL
   

ATL / WTL / STL

 
GeneralRe: xstring info Pin
Senkwe Chanda23-Oct-02 1:35
Senkwe Chanda23-Oct-02 1:35 
GeneralRe: xstring info Pin
Tim Smith23-Oct-02 2:38
Tim Smith23-Oct-02 2:38 
GeneralRe: xstring info Pin
ian mariano29-Oct-02 3:04
ian mariano29-Oct-02 3:04 
GeneralCOM EXE is not inheriting PATH environment variable from the calling process Pin
ksgopi22-Oct-02 16:07
ksgopi22-Oct-02 16:07 
QuestionMFC's CObject and CObList equivalents in ATL? Pin
LukeV22-Oct-02 5:40
LukeV22-Oct-02 5:40 
AnswerRe: MFC's CObject and CObList equivalents in ATL? Pin
Anonymous24-Oct-02 6:27
Anonymous24-Oct-02 6:27 
GeneralHTML Source of MSHTML Pin
jajamal22-Oct-02 5:39
jajamal22-Oct-02 5:39 
GeneralRe: HTML Source of MSHTML Pin
Paul M Watt22-Oct-02 12:41
mentorPaul M Watt22-Oct-02 12:41 
The key thing that you need to do is use the IPersistStreamInit interface. This will allow you to get the data. This function goes a step further and verifies that IE is holding a HTML doc, however you could change this to grab any data.

HRESULT GetDocumentContent(IWebBrowser2 *pWebBrowser2, CComBSTR &bstrHTMLText)
{
			//C: Clear the bstr output parameter.
	bstrHTMLText.Empty();
			//C: Get the WebBrowser's document object
	CComPtr<IDispatch> pDisp;
	HRESULT hr = pWebBrowser2->get_Document(&pDisp);
	if (FAILED(hr))
	{
		return hr;
	}
			//C: Verify that what we get is a pointer to a IHTMLDocument2 
			//   interface. 
	CComQIPtr<IHTMLDocument2, &IID_IHTMLDocument2> spHTML = pDisp;
			//C: Extract the source code of the document
	if (spHTML)
	{
		CHAR	*szData = NULL;
		OLECHAR *htmlText = NULL;
		try
		{
			//C: Query for the persist stream that holds the original data.
			CComQIPtr<IPersistStreamInit, &IID_IPersistStreamInit> spData = spHTML;
			CComPtr<IStream>	spStream;
			//C: Create an IStream object to receive the data.
			::CreateStreamOnHGlobal(NULL, TRUE, &spStream);
			//C: Save the data to this new stream memory.
			spData->Save(spStream ,FALSE);

			STATSTG stat;
			spStream->Stat(&stat, STATFLAG_NONAME);
			
			szData = new CHAR[stat.cbSize.LowPart];
			ULONG length;

			LARGE_INTEGER pos;
			pos.QuadPart = (__int64)0;
			spStream->Seek(pos, STREAM_SEEK_SET, NULL);
			spStream->Read(szData, stat.cbSize.LowPart, &length);

			htmlText = new OLECHAR[length];
			::MultiByteToWideChar(CP_ACP, 0, szData, length, htmlText, length);
			bstrHTMLText = htmlText;
		}
		catch (...)
		{
			//C: No current operations.
		}
			//C: Free resources.
		delete[] htmlText;
		delete[] szData;
	}
	else
	{
			//C: The document is not an HTML page.
			//C: No current operations.
	}
 	return S_OK;  
}



Build a man a fire, and he will be warm for a day
Light a man on fire, and he will be warm for the rest of his life!

GeneralRe: HTML Source of MSHTML Pin
jajamal22-Oct-02 22:50
jajamal22-Oct-02 22:50 
GeneralARRGHH!! MessageBox call from a dll Pin
Phil.Benson21-Oct-02 22:29
professionalPhil.Benson21-Oct-02 22:29 
GeneralATL & databases Pin
LukeV21-Oct-02 17:56
LukeV21-Oct-02 17:56 
GeneralRe: ATL & databases Pin
Vagif Abilov21-Oct-02 19:59
professionalVagif Abilov21-Oct-02 19:59 
GeneralRe: ATL & databases Pin
Jörgen Sigvardsson1-Nov-02 0:47
Jörgen Sigvardsson1-Nov-02 0:47 
Generaldate/time parsing and formatting (STL) Pin
SNagase21-Oct-02 9:54
SNagase21-Oct-02 9:54 
GeneralClassWizard database Pin
Jose Cruz21-Oct-02 9:35
Jose Cruz21-Oct-02 9:35 
GeneralRe: ClassWizard database Pin
Michael Dunn21-Oct-02 17:02
sitebuilderMichael Dunn21-Oct-02 17:02 
GeneralRe: ClassWizard database Pin
yeeeooowww29-Oct-02 1:37
yeeeooowww29-Oct-02 1:37 
GeneralProblem with ShellExtension on Win98 Pin
KaЯl21-Oct-02 5:30
KaЯl21-Oct-02 5:30 
QuestionCStringT::Tokenize too slow??? Pin
LukeV20-Oct-02 17:28
LukeV20-Oct-02 17:28 
AnswerRe: CStringT::Tokenize too slow??? Pin
Tim Smith21-Oct-02 10:26
Tim Smith21-Oct-02 10:26 
QuestionHow can I set the pos and size of my control? Pin
Anonymous19-Oct-02 20:48
Anonymous19-Oct-02 20:48 
GeneralSTL - list.erase and list.remove Pin
#realJSOP18-Oct-02 6:26
professional#realJSOP18-Oct-02 6:26 
GeneralRe: STL - list.erase and list.remove Pin
User 988518-Oct-02 6:40
User 988518-Oct-02 6:40 
GeneralRe: STL - list.erase and list.remove Pin
Michael Dunn18-Oct-02 13:19
sitebuilderMichael Dunn18-Oct-02 13:19 
GeneralRe: STL - list.erase and list.remove Pin
#realJSOP19-Oct-02 1:10
professional#realJSOP19-Oct-02 1:10 

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.