Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1979
  • Last Modified:

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
0
ed987
Asked:
ed987
1 Solution
 
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

Featured Post

Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

Tackle projects and never again get stuck behind a technical roadblock.
Join Now