Jump to content
  • Advertisement
Sign in to follow this  
willthiswork89

mshtml

This topic is 4680 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

im having so much trouble with parsing lightweight html its unbeleivable....nothing will compile..ivbe googled it and nothing will compile because i use bloodshed idecan sombody give me an example that compiles in bloodshed dev ide? just to parse basic html

Share this post


Link to post
Share on other sites
Advertisement
Quote:
Original post by willthiswork89
im having so much trouble with parsing lightweight html its unbeleivable....nothing will compile..ivbe googled it and nothing will compile because i use bloodshed idecan sombody give me an example that compiles in bloodshed dev ide? just to parse basic html


What exactly is it that you want to do ?

You want to parse the tags and put them in a tree ?

Share this post


Link to post
Share on other sites
<html>
<head>
<body bgcolor="black" text="white">
I Want To See this On My Screen!
</body>
</head>
</html>

i want to parse that and see it inside a window? not sure if it can be done because i havnt found many things on it.

Share this post


Link to post
Share on other sites
Quote:
Original post by willthiswork89
<html>
<head>
<body bgcolor="black" text="white">
I Want To See this On My Screen!
</body>
</head>
</html>

i want to parse that and see it inside a window? not sure if it can be done because i havnt found many things on it.


Parsing it and displaying it yourself is an incredibly tedious task. I would suggest you look into some sort of control for the platform you are developping on, or to find another way to solve your problem. If you are REALLY interested in this (remember that there have been several man-years devoted to this topic by big entities and that their offerings aren't even displaying everything according to the standard yet, your best bet is to visit W3C's website and start reading.

Share this post


Link to post
Share on other sites
i know its easy for .net to do this...but i didnt know it was harder for c++....thanks though. I am making a hack for a game, it requires and html page....is there even a way to open an html file up inside of the exe?

Share this post


Link to post
Share on other sites
http://www.codeproject.com/internet/parse_html.asp

heres a code...i get about 1,000,000,000 errors

Quote:
#include <windows.h>
#include <mshtml.h>

OLECHAR szHTML[] = OLESTR("<HTML><BODY>Hello World!</BODY></HTML>");

int __stdcall WinMain(HINSTANCE hInst,
HINSTANCE hPrev,
LPSTR lpCmdLine,
int nShowCmd)
{
IHTMLDocument2 *pDoc = NULL;

CoInitialize(NULL);

CoCreateInstance(CLSID_HTMLDocument,
NULL,
CLSCTX_INPROC_SERVER,
IID_IHTMLDocument2,
(LPVOID *) &pDoc);

if (pDoc)
{
IPersistStreamInit *pPersist = NULL;

pDoc->QueryInterface(IID_IPersistStreamInit,
(LPVOID *) &pPersist);

if (pPersist)
{
IMarkupServices *pMS = NULL;

pPersist->InitNew();
pPersist->Release();

pDoc->QueryInterface(IID_IMarkupServices,
(LPVOID *) &pMS);

if (pMS)
{
IMarkupContainer *pMC = NULL;
IMarkupPointer *pMkStart = NULL;
IMarkupPointer *pMkFinish = NULL;

pMS->CreateMarkupPointer(&pMkStart);
pMS->CreateMarkupPointer(&pMkFinish);

pMS->ParseString(szHTML,
0,
&pMC,
pMkStart,
pMkFinish);

if (pMC)
{
IHTMLDocument2 *pNewDoc = NULL;

pMC->QueryInterface(IID_IHTMLDocument,
(LPVOID *) &pNewDoc);

if (pNewDoc)
{
// do anything with pNewDoc, in this case
// get the body innerText.

IHTMLElement *pBody;
pNewDoc-gt;get_body(&pBody);

if (pBody)
{
BSTR strText;

pBody->get_innerText(&strText);
pBody->Release();

SysFreeString(strText);
}

pNewDoc->Release();
}

pMC->Release();
}

if (pMkStart)
pMkStart->Release();

if (pMkFinish)
pMkFinish->Release();

pMS->Release();
}
}

pDoc->Release();
}

CoUninitialize();

return TRUE;
}

Share this post


Link to post
Share on other sites
Quote:
Original post by willthiswork89
http://www.codeproject.com/internet/parse_html.asp

heres a code...i get about 1,000,000,000 errors

Post the first couple of errors.

Share this post


Link to post
Share on other sites
15 C:\Dev-Cpp\Untitled1.cpp `CLSID_HTMLDocument' undeclared (first use this function)

23 C:\Dev-Cpp\Untitled1.cpp `IPersistStreamInit' undeclared (first use this function)

23 C:\Dev-Cpp\Untitled1.cpp `pPersist' undeclared (first use this function)

30 C:\Dev-Cpp\Untitled1.cpp `IMarkupServices' undeclared (first use this function)

30 C:\Dev-Cpp\Untitled1.cpp `pMS' undeclared (first use this function)

35 C:\Dev-Cpp\Untitled1.cpp `IID_IMarkupServices' undeclared (first use this function)

40 C:\Dev-Cpp\Untitled1.cpp `IMarkupContainer' undeclared (first use this function)

66 C:\Dev-Cpp\Untitled1.cpp `get_body' undeclared (first use this function)


just about every function in there
40 C:\Dev-Cpp\Untitled1.cpp `pMC' undeclared (first use this function)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!