// 웹페이지에 있는 javascript 함수를 호출한다.

    m_pIWeb = GetIWebPointer();

    IDispatch *pDisp=NULL;

    VARIANT varRet;

    m_pIWeb->get_Document(&pDisp);

    IHTMLDocument2* pHtmlDoc = (IHTMLDocument2*)pDisp;

    IHTMLWindow2* pHtml;

    pHtmlDoc->get_parentWindow(&pHtml);



    CString sFunc = "func_control_call();";

    BSTR pbFunc = sFunc.AllocSysString();

    CString sLang = "javascript";

    BSTR pbLang = sLang.AllocSysString();

    pHtml->execScript(pbFunc, pbLang, &varRet);

    pDisp->Release();

   // ------------------------------------------------------------



IWebBrowser2* CClockCtrl::GetIWebPointer()        // 브라우저 포인터 얻기.

{

    HRESULT hr ;

    IOleContainer *pIContainer = NULL ;

    IWebBrowser2 *pIWeb = NULL ;

    IServiceProvider *pISP = NULL ;

    

    // Get IOleClientSite interface pointer.

    LPOLECLIENTSITE pIClientSite = GetClientSite() ;

    

    // Get IOleContainer interface poineter.

    hr = pIClientSite->GetContainer(&pIContainer) ;

    if (hr != S_OK) {

        pIClientSite->Release() ;

        return NULL ;

    }

    

    // Get IServiceProvider interface pointer.

    hr = pIClientSite->QueryInterface(IID_IServiceProvider,

        (void **)&pISP) ;

    if (hr != S_OK) {

        pIContainer->Release() ;

        pIClientSite->Release() ;

        return NULL ;

    }



    // Get IWebBrowser2 interface pointer.

    hr = pISP->QueryService(IID_IWebBrowserApp,

        IID_IWebBrowser2,(void**)&pIWeb) ;

    if (hr != S_OK) {

        pIContainer->Release() ;

        pIClientSite->Release() ;

        pISP->Release() ;

        return NULL ;

    }

    // release interface.

    pIContainer->Release() ;

    pIClientSite->Release() ;

    pISP->Release() ;

    return pIWeb ;

}