它返回的是一个IHTMLElement 接口
你应该调用IHTMLElement::QueryInterface
并要求获得IHTMLScriptElement接口
如果对象实现了该接口将返回对应的接口指针并返回S_OK 
否则将返回E_NOINTERFACE

解决方案 »

  1.   

    should work, look here (in Japanese, but you read the code):http://member.nifty.ne.jp/LILILIN/HOWTO/activex_javascript.htmor use document's get_scripts methods
      

  2.   

    感谢大家,是我调用有问题,应该如下调用
    CComBSTR str("script");
    m_pDoc2->createElement( str, &pEle ) );
    IHTMLScriptElementPtr p = pEle;
    assert( p !=  0 );
    我在调用createElement的时候第一个参数传递有问题。
    m_pDoc2->createElement( L"script", &pEle ) )