Question

I've got a valid IHTMLElement object that points to an image in IE9. The image data was recently updated via an IDirectDrawSurface. I'm trying to find a way to force IE9 to repaint the image in the DOM after I update the image data. Could anyone please direct me to a method of forcing a repaint of an image that has been updated in this fasion?

Approaches I've tried:

HRESULT ret = pElement->get_style(&pStyle);
pStyle->put_visibility(L"hidden");
pStyle->put_visibility(L"visible");
// Or
pStyle->put_display(L"none");
pStyle->put_display(L"block");

Thanks for your time, and any tips would be greatly appreciated.

-Will

Was it helpful?

Solution

Have you tried resetting the src of the element? From what I can see, IE won't do anything if you set the same src that is already present, but looks like it can be tricked;

    IHTMLImgElement pImg;
    m_pElement->QueryInterface(IID_IHTMLImgElement, (void**)(&pImg));
    _bstr_t bstrOriginalSrc;
    pImg->get_src(bstrOriginalSrc.GetAddress());
    pImg->put_src(L""); //Trick to avoid setting the same src as already present
    pImg->put_src(bstrOriginalSrc);
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top