Disable Events of HTMLElement
-
Hey Friends Is it possible to disable events of a HTMLElement? Let's say in html code, there are events defined for some html elements Let's say [Click Here](some link) Now i host a webbrowser in my dialog based app and i do not want custom onselect event to be fired(i.e something here above) may be something we can do with IHTMLElement * pElem = NULL; IHTMLElement2 * pElem2 = NULL; IHTMLElement3 * pElem3 = NULL; all above interfaces have put_ functions but if i pass NULL, it means to them default behavior (i.e onselect="something here") or i can define function in my .cpp file to be called i do not want any of the above i just want htmlelement not to call onselect="something here" that's it Any Ideas? Regards
-
Hey Friends Is it possible to disable events of a HTMLElement? Let's say in html code, there are events defined for some html elements Let's say [Click Here](some link) Now i host a webbrowser in my dialog based app and i do not want custom onselect event to be fired(i.e something here above) may be something we can do with IHTMLElement * pElem = NULL; IHTMLElement2 * pElem2 = NULL; IHTMLElement3 * pElem3 = NULL; all above interfaces have put_ functions but if i pass NULL, it means to them default behavior (i.e onselect="something here") or i can define function in my .cpp file to be called i do not want any of the above i just want htmlelement not to call onselect="something here" that's it Any Ideas? Regards
There isn't one place where all events are received. You can only divert one event at a time if you want to deal with events. However, IHTMLElement3 has disabled attribute that you can set to TRUE. This will disable any interaction with that IHTMLElement. Of course, first you have to reach that element. Other than that you can set the parent window as disabled and then you would not be able to do anything with that HTML control.
-
There isn't one place where all events are received. You can only divert one event at a time if you want to deal with events. However, IHTMLElement3 has disabled attribute that you can set to TRUE. This will disable any interaction with that IHTMLElement. Of course, first you have to reach that element. Other than that you can set the parent window as disabled and then you would not be able to do anything with that HTML control.
hi thanks for the help i do not want to disable complete html element i just want to disable a specific dhtml event onclick, onfocus seperately
-
hi thanks for the help i do not want to disable complete html element i just want to disable a specific dhtml event onclick, onfocus seperately
-
yeah thanks will try it now and will update
-
IHTMLElement * pElem; IHTMLElement2 * pElem2; //Get pElem & pElem2 CString vl_sHelper("onclick"); COleVariant vl_oOnClick; pElem->get_onmouseover(&vl_oOnClick);// This should get the onclick event? pElem2->detachEvent(vl_sHelper.AllocSysString(),vl_oOnClick);//COleVariant to IDispatch* sounds strange to compiler
-
IHTMLElement * pElem; IHTMLElement2 * pElem2; //Get pElem & pElem2 CString vl_sHelper("onclick"); COleVariant vl_oOnClick; pElem->get_onmouseover(&vl_oOnClick);// This should get the onclick event? pElem2->detachEvent(vl_sHelper.AllocSysString(),vl_oOnClick);//COleVariant to IDispatch* sounds strange to compiler
-
It does because it is. Why COleVariant, can't you use VARIANT of type VT_DISPATCH? It is easier. And pElem and pElem2 should be the same element.
yeah thanks compiled and ran successfully detachEvent returns SUCCESS however, seems something is missing it still calls the event written in html :-(
-
It does because it is. Why COleVariant, can't you use VARIANT of type VT_DISPATCH? It is easier. And pElem and pElem2 should be the same element.
hey buddy thanks for the help found a workaround 1st find out the event then get outer html modify outer html put it back not good but works
-
hey buddy thanks for the help found a workaround 1st find out the event then get outer html modify outer html put it back not good but works