????? ??????/????? ?????? ?? ????? ?? ???????? ?????

?????? ????????? ?????? ?????????
???? ???????: 188015 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

??????

??? ??????? ???? ?????? WebBrowser ?? ????? Visual C++ ? ?? ???? ?? ??????? ?????? ??? ?????? ?? ????? ?????? ?? ???????? ????? ??? ???? ???. ???? ??? ??????? ????? ?????? ???? ?? ???? ????? ????? IDocHostUIHandler.

??????? ????

????? ?????? ????? IDocHostUIHandler ?????? ?? ?????? ?? ????? "????? ????????" ?????? ???? ?????? WebBrowser ?? ??????? ??????. ???? IDocHostUIHandler ????? ????? "???? ???? HTML ????????" (DHTML) ?????? ??? ?????? ?????? ????? ?? ??? ?????? ???.

????? ????? GetExternal() IDocHostUIHandler ??? ???????. ??? ??????? ?????? ??? ??? ???? ??? "window.external.yourMethod" ? ?????? ???? ?????? WebBrowser ????? GetExternal ????? ???????? ???? IDispatch ??????? ??????? ????? ??. ??? ???? ??? ?????? ???? ?????? ??? ?????? ?????? ?????? ???? ?????? WebBrowser.

????? ???? ??? ???? ?????? WebBrowser ???? IDispatch ???????, ?? ?????? IDispatch::GetIDsOfNames() ?????? ??? DISPID ??????? ?? ??????? ???? ?? ????????? ?? ???????? ????? yourMethod ?? ??? ??????.

???????? ????????? ???? ?????? WebBrowser IDispatch::Invoke() ?? DISPID ??????? ?? GetIDsOfNames().

???? ??? ??????? ???? ??? ?? ???? ?????? ???? ???? DHTML ??? ????? ?? ?????? ??? ????? ??????? ?? ??????? ?? ???????? ?????:
  1. ????? IDocHostUIHandler.
  2. ????? ????? IDocHostUIHandler::GetExternal. ????? ?? IDispatch ??????? ???? ???? ??????? ???? ????:
    STDMETHOD(GetExternal)(IDispatch** ppDispatch)
    {
       // Assumes you inherit from IDispatch
       *ppDispatch = (IDispatch*)this;
       (*ppDispatch)->AddRef();
    
       return S_OK;
    }
    					
  3. ?????? ??????? ????? (DISPID) ????? ?? ????? ?? GetIDsOfNames. ??? ??? ?????? ????? ?? ????? ??????? ????? ??? ??? ????? ???.
  4. ????? DISPID ??????? ?? ??????? ?? ??????? IDispatch::Invoke ???? ????:
    STDMETHODIMP CAtlBrCon::Invoke(DISPID dispidMember, REFIID riid,
                                   LCID lcid, WORD wFlags,
                                   DISPPARAMS* pDispParams,
                                   VARIANT* pvarResult,
                                   EXCEPINFO* pExcepInfo, UINT* puArgErr)
    {
       switch (dispidMember)
       {
          case DISPID_MYMETHOD_OR_PROPERTY:
             // Do something here
    
          default:
             return E_INVALIDARG;
       }
    
       return S_OK;
    }
    					
  5. ??????? ??????? ?? ??????? ?????? ?? ???????? ????? ??? ???:
     <SCRIPT LANGUAGE="VBScript">
        Sub SomeControl_OnClick
           window.external.yourMethod
        End Sub
     </SCRIPT>
    					

?????

?????? ??? ???? ?? ????????? ??? ???????? ??????? ?? ??? ???????? ?????? ?????? ??? ??????? ???? ????? "?????? ?????? ???????" IDocHostUIHandler ?? MSDN ???? ??? ??? ????????:
http://msdn.microsoft.com/workshop/
(?) 1998 ???? Microsoft ? ???? ???? ?????. ????????? ?????? ???? Roberts ? ???? Microsoft

???????

???? ???????: 188015 - ????? ??? ??????: 12/???? ??????/1435 - ??????: 2.1
????? ???
  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 5.0
  • Microsoft Internet Explorer 5.5
????? ??????: 
kbnosurvey kbarchive kbmt kbfaq kbhowto kbscript kbwebbrowser KB188015 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????188015

Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from smallbusiness.support.microsoft.com