Spécification du code html d'un TCppWebBrowser
Bonjour tous le monde,
j'ai réussi a affiché n'importe quel message formaté html sur ce dernier avec la méthode suivante :
Code:
1 2 3 4 5 6 7 8 9 10 11
| IPersistStreamInit* pPSI;
pStream->Seek(0, 0);
while(!CppWebBrowser1->Document)
Application->ProcessMessages();
IPersistStreamInit *psi;
TStreamAdapter* pStreamAdapter = new TStreamAdapter(
pStream, soReference);
_di_IStream sa(*(new TStreamAdapter(pStream, soReference)));
if (SUCCEEDED(CppWebBrowser1->Document->QueryInterface(IID_IPersistStreamInit,(void **)&psi)))
psi->Load( sa );
psi->Release (); |
mon problème, c'est la récupération du code html d'une page affiché sur le composant, pour cela j'ai tous essayé, rien ne fonctionne, ça par exemple :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| IHTMLDocument3 *html = NULL;
IHTMLElement *element = NULL;
BSTR string = L"";
try
{
if (CppWebBrowser1->Document != NULL)
{
OleCheck(CppWebBrowser1->Document->QueryInterface(IID_IHTMLDocument3,(LPVOID*)&html));
OleCheck(html->get_documentElement(&element));
element->put_outerHTML (c);
affiche (c);
}
}
catch (EOleSysError &eOSE)
{
if (element != NULL)
{
element->Release();
}
if (html != NULL)
{
html->Release();
}
throw eOSE;
} |
Toutes suggestions seraient la bienvenue.
Mes remerciements d'avance, moh