FIX: ??? ??? ????? ?????? ScriptControl ?? VBScript ?? MFC

?????? ????????? ?????? ?????????
???? ???????: 184977 - ??? ???????? ???? ????? ????? ??? ???????.
????? ???? | ?? ????

?? ??? ??????

???????

??? ??????? ?????? ScriptControl ?? ????? MFC ? ?? ???? ????? ????? ???????:
???? ????? ??????? ???? ??? ????? ???? ??????? ?????? ??? ??? ????.
???? ??? ??? ?? ??? ?????? ????? ????? ??? VBScript ???????? ????? SetLanguage. ?? ???? ??? ????? ??? ?? ????? JScript ?? JavaScript ?? ????? ????? ScriptControl.

?????

??? ??????? ????? ???? (? ????? ??????? ???????? ????? ???? ???) ? ?????? ScriptControl ??? ????? ???? ???? ???? ??? ???? ????? ??????? VBScript.

????

???? ??? ???? ?????:
  • ??? ????? ??? ????? ??? ???????:

    ????? ??????? ScriptControl::SetLanguage(NULL) ?????? ??? ??????? ScriptControl::SetLanguage("VBScript").
  • ????? ???? ScriptControl:

    ????? ?? ???? ???? ??????? ????????? ???? ?????? ?? ScriptControl ??? ????? ?????? Script ?????? ??? ???? ??????? ???????? ????? ?? ???? ???? full-blown. ????? ???? ???? ?? ????? ?????? ????? ?????? ??? ??????? ??? improving ??????. ????? ?????? ?? ????? ??? ???????? ???? ?????? ?? ActiveX ?????? ????? ??? ???? ????? ????? ?? ???-"????? ?????? ?????? ?????? ??" ???? ??????.
???? ??? ??? ?? ????? ???????? ???????? ????? CoCreateInstance ?????? ?? ScriptControl ?????? COM 5.0 Visual C++ ?? ???????.

??? ?????

// Import Type Info from Script OCX - point path to the
// location of the Script Control on your development computer.
#import "C:\Program Files\Microsoft Script Control\msscript.ocx"

void CScrptctrlView::OnInitialUpdate()
{
   CView::OnInitialUpdate();

   OleInitialize(NULL); // Only if you haven't done this already
                        // or called AfxOleInit.
   using namespace MSScriptControl;
   try  // Make sure exception handling is turned on.
   {
      _bstr_t bstrLanguage(L"VBScript");
      _bstr_t bstrCode(L"MsgBox \"Hello World\"");

      // Create the Script Control, initialize Language, and
      // add code for processing.
      IScriptControlPtr spScriptCtl(__uuidof(ScriptControl));
      spScriptCtl->put_Language(bstrLanguage);
      spScriptCtl->AddCode(bstrCode);
   }
   catch(_com_error e)
   {
      TRACE(_T("Error (%08x) in %s: %s\n"), e.Error(),
                           e.Source(), e.Description());
   }
}
				

?????

???? Microsoft ?? ??? ??? ?? ?????? Microsoft ??????? ?? ????? ??? ???????. ?? ????? ??? ??????? ?? Microsoft Internet Explorer 5.

??????? ????

????? ????? ????? ??????

  1. ????? ????? SDI MFC ???? ?? ?????? ??????? AppWizard ??? ?? ??? ??? ????? ???? ActiveX.
  2. ????? ScriptControl ?? ???? ????? "ScriptControl ????" ?? ?????? "????? ???? ActiveX ?????" ??? Project\Add ??? ???? ??????? Project\Components ?????? ??????. ???? ???? ??????????? ??? ?????? ?????? ???? ????.
  3. ?? ????? OnInitialUpdate ?? ????? ????? ????? ???????? ???????? ???????:
    // Import Type Info from Script OCX - point path to the
    // location of the Script Control on your development computer.
    #import "C:\Program Files\Microsoft Script Control\msscript.ocx"
    
    void CScrptctrlView::OnInitialUpdate()
    {
      CView::OnInitialUpdate();
    
      OleInitialize(NULL); // Only if you haven't done this already
                           // or called AfxOleInit.
      using namespace MSScriptControl;
      try  // Make sure exception handling is turned on.
      {
         _bstr_t bstrLanguage(L"VBScript");
         _bstr_t bstrCode(L"MsgBox \"Hello World\"");
    
         // Create the Script Control, initialize Language, and
         // add code for processing.
         IScriptControlPtr spScriptCtl(__uuidof(ScriptControl));
         spScriptCtl->put_Language(bstrLanguage);
         spScriptCtl->AddCode(bstrCode);
      }
      catch(_com_error e)
      {
         TRACE(_T("Error (%08x) in %s: %s\n"), e.Error(),
                              e.Source(), e.Description());
      }
    }
    						
  4. ????? # ????? ???? ???? ?????? ????? ??? ???????? ?????? Scriptcontrol.h ? ??? ????? ????? ?????? # ID_SCRIPT_CONTROL ?? Resource.h ????? ??. ?????? ??????? ???????.

?????

?????? ??? ???? ?? ?????????? ?????? ?????? article(s) ??????? ?? "????? ??????? ?? Microsoft:
184904FILE: ??? ????? ?????? ??????? ?????? MSSCPCTL.EXE MSSCPCTL.H
?????? ??? ???? ?? ?????????? ?????? ?????? URL ??? ??????:
http://msdn2.microsoft.com/en-us/library/ms950396.aspx

???????

???? ???????: 184977 - ????? ??? ??????: 25/???/1428 - ??????: 2.2
????? ???
  • Visual Basic, Scripting Edition 3.0
  • Microsoft Visual C++ 5.0 Enterprise Edition
  • Microsoft Visual C++ 5.0 Professional Edition
????? ??????: 
kbmt kbbug kbfix kbie500fix KB184977 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????184977
????? ??????? ?? ????? ???? ?? ????? ???????
?? ????? ????? ?????? ???? ???? ???? ??? ??????? ??? ?? ? ?? ??? ??????? Microsoft ??? ????? ??? ??????? ????? ?????? ?????

????? ???????

 

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