createElement IHTMLScriptElement

IHTMLElement       *elem = NULL;
sph->createElement (bs = ::SysAllocString(L"<script>"), &elem);

how to get IHTMLScriptElement out of IHTMLElement *elem ?
i tried using CComQIPtr< IHTMLScriptElement, &IID_IHTMLScriptElement > sce=elem; but sce->put_text(...); fails to do anything
LVL 7
ed987Asked:
Who is Participating?
 
mahesh1402Commented:
>>how to get IHTMLScriptElement out of IHTMLElement *elem ?

try something like this :

CComPtr<IHTMLElement> spElem;
pDoc->createElement(CComBSTR("SCRIPT"), &spElem);

CComPtr<IHTMLScriptElement> spScript;
spElem->QueryInterface(&spScript);

//Use spScript

---OR---

  CComPtr<IHTMLElement> spElement;
  CComPtr<IHTMLScriptElement > spScript;

  pDoc->createElement(CComBSTR("SCRIPT"), &spElement);
  spElement->QueryInterface(IID_IHTMLScriptElement,(void**)&spScript );
  spScript->put_text(.......);

-MAHESH
0
 
Computer101Commented:
Forced accept.

Computer101
EE Admin
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.