Question about function "HTMLDocument_write"
On Monday the patch realizing this function has been accepted. It works perfectly, but hyperlinks do not work. If I makes this function that way: static HRESULT WINAPI HTMLDocument_write(IHTMLDocument2 *iface, SAFEARRAY *psarray) { HRESULT hres; VARIANT *pvar; IHTMLElement *pbody; BSTR vtext; int i; vtext = SysAllocString(L""); HTMLDocument_get_body(iface,&pbody); hres = IHTMLElement_get_innerHTML(pbody, &vtext); if (FAILED(hres)) { vtext = SysAllocString(L""); } hres=SafeArrayAccessData(psarray, (void **)&pvar); if (FAILED(hres)) return hres; for (i=0; i < psarray->rgsabound[0].cElements; i++) { hres = VarBstrCat(vtext, V_BSTR(&(pvar[i])), &vtext); if (FAILED(hres)) { break; } } IHTMLElement_put_innerHTML(pbody,vtext); SysFreeString(vtext); hres = SafeArrayUnaccessData(psarray); return S_OK; } hyperlinks works good. Why so occurs?
Ivan Sinitsin wrote:
On Monday the patch realizing this function has been accepted. It works perfectly, but hyperlinks do not work.
What do you mean by hyperlinks don't work?
If I makes this function that way:
[...] hyperlinks works good.
Why so occurs?
As I've explained in comment to your patch, this implementation is wrong. Jacek
What do you mean by hyperlinks don't work?
I have such code which create html page: htmlDoc2->lpVtbl->open(htmlDoc2, L"html/txt", vnull, vnull, vnull, &pdisp); bstr =SysAllocString(L"<html><head></head><body><p>Simple text</p>"); if ((pVar->bstrVal = bstr)) { htmlDoc2->lpVtbl->write(htmlDoc2, sfArray); } SysFreeString(bstr); bstr = SysAllocString(L"<br><a href='http://www.yandex.ru'>Link to the Yandex"); if ((pVar->bstrVal = bstr)) { htmlDoc2->lpVtbl->write(htmlDoc2, sfArray); } SysFreeString(bstr); bstr = SysAllocString(L"</a><br>End of document</body></html>"); if ((pVar->bstrVal = bstr)) { htmlDoc2->lpVtbl->write(htmlDoc2, sfArray); } SysFreeString(bstr); htmlDoc2->lpVtbl->close(htmlDoc2); After creation of page, I try to click on a hyperlink, but nothing occurs. When I used my patch, hyperlink works good.
As I've explained in comment to your patch, this implementation is wrong.
I do not speak, that my patch better than yours or my patch is right. I only want to understand, why so occurs and where to look?
Jacek
-- Sinitsin Ivan
participants (2)
-
Ivan Sinitsin -
Jacek Caban