createElement IHTMLScriptElement

Posted on 2007-07-24
Last Modified: 2013-11-25
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
Question by:ed987
    LVL 22

    Accepted Solution

    >>how to get IHTMLScriptElement out of IHTMLElement *elem ?

    try something like this :

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

    CComPtr<IHTMLScriptElement> spScript;

    //Use spScript


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

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

    LVL 1

    Expert Comment

    Forced accept.

    EE Admin

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Join & Write a Comment

    Suggested Solutions

    Title # Comments Views Activity
    Unix / Linux grid computing 5 98
    tenRun challenge 28 67
    bunnyEars2 challenge 6 46
    Change to event 1 49
    Article by: SunnyDark
    This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
    There is an easy way, in .NET, to centralize the treatment of all unexpected errors. First of all, instead of launching the application directly in a Form, you need first to write a Sub called Main, in a module. Then, set the Startup Object to th…
    The viewer will learn how to implement Singleton Design Pattern in Java.
    The viewer will learn additional member functions of the vector class. Specifically, the capacity and swap member functions will be introduced.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    17 Experts available now in Live!

    Get 1:1 Help Now