PRB: ???? ??? ???????? ????? ??? ??????? ??? ???? ??? ?????

?????? ????????? ?????? ?????????
???? ???????: 165967 - ??? ???????? ???? ????? ????? ??? ???????.
??? ????? ??? ???????. ????? "??? ??" ??? ??? ??????? ??? ????.
????? ???? | ?? ????

???????

????? ??? ????? ?????? ????? ?????? ???? ??? ??????? ?? ??? ??? ?????? ??? ?????? ???? ??????? ??????:
<object>"?? ????? ?????? ??? ??????? ?? ??? ??????? ' <????>. <method>'"

?????

????? VBSCRIPT ??????? ?????? ??????? ????? ???? ?? ?????? ?? ??? Microsoft ??? ??????? SAFEARRAYs ?????????. ????? VBSCRIPT ????? ??? ???? ????? ??? ????? ??? ???? ????? ?? ???? ????? ??? ??????? ???????? ?????? ??????, ?? ???? ?????? ?????? ????????? ?????? ?? ??? ?????.

?? ???? ???? ??????? ?????? ?????? JSCRIPT ??? ?????? ?????? ?? ??????? SAFEARRAYs ?? ?? ??? ??? ?? ??? ?????????. ??? ???? ??? JSCRIPT ???? ??? ????? SAFEARRAYs ?? ???? ??????? ???????? ???? ??? ???.

????

????? ???? ???? ?? ????????? ????????? ???? ?????? VBSCRIPT ? ??? ????? ???????? ??????? ???????? SAFEARRAYs ?????????. ??? ?? ???? ??? ???????? VARIANT ???? ?? ????? VARIANT SAFEARRAY ??? ??????? ??? ???? VBSCRIPT.

???? ??????? ??????? ?????? ???????? ?? VBSCRIPT ?????? TypeName ???? ?? ??? ???????? ?????. ???? ?????? TypeName ?????? ??????? "Variant() ?" ???????? ???????? ??? ????? ???? ???????.

???? ??????? ??????? ?????? ???????? ?? JSCRIPT ???? ??????? typeof ?????? ??? ?????? ???????. ???? ??????? typeof ?????? ????? "????? ?" ???????? ?????? ???????? ????? ???????? ??? ????? ?????? JSCRIPT.

?????

????? ??? ?????? ??? ???????.

??????? ????

??? VBSARRAY ????? ?????? ???? ????? (ATL) ???? ?????? ??????? 2.1 ???? ??? ??????. ?????? ?????? ????? ?????? Ivbsa ????? ???? ???: TestBstrs TestVariants ? ? TestPassArray. ???? ????? ??????? ???? ??????? SAFEARRAY BSTRs. ???? ?????? ???? ?????? ??? ?? BSTRs ?? VARIANT. ???? ??????? ?? ?? ??? VARIANT ??? ???? ????? ?? ???? VBSCRIPT ?? JSCRIPT ??? ??????. ???? ???????? ??? ??.

????? ??? ????? TestVariants:
      // Return a VARIANT array of VARIANTs which hold BSTRs
      STDMETHODIMP Cvbsa::TestVariants(VARIANT * pvaVariant)
      {
         HRESULT hr = NOERROR;
         LPSAFEARRAY psa;
         SAFEARRAYBOUND rgsabound[]  = { 3, 0 }; // 3 elements, 0-based
         int i;

         if (!pvaVariant)
         {
            return E_INVALIDARG;
         }

         VariantInit(pvaVariant);

         psa = SafeArrayCreate(VT_VARIANT, 1, rgsabound);
         if (!psa)
         {
            return E_OUTOFMEMORY;
         }

         VARIANT vFlavors[3];
         for (i = 0; i < 3; i++)
         {
            VariantInit(&vFlavors[i]);
            V_VT(&vFlavors[i]) = VT_BSTR;
         }

         V_BSTR(&vFlavors[0]) = SysAllocString(OLESTR("Vanilla"));
         V_BSTR(&vFlavors[1]) = SysAllocString(OLESTR("Chocolate"));
         V_BSTR(&vFlavors[2]) = SysAllocString(OLESTR("Espresso Chip"));
         if (!V_BSTR(&vFlavors[0]) || !V_BSTR(&vFlavors[1]) ||
             !V_BSTR(&vFlavors[2]))
         {
            hr = E_OUTOFMEMORY;
            goto Error;
         }

         {
                //Plug references to the data into the SAFEARRAY
               LPVARIANT rgElems;
               if (FAILED(hr = SafeArrayAccessData(psa,(LPVOID*)&rgElems)))

            {
               goto Error;
            }
            for (i = 0; i < 3; i++)
            {
               rgElems[i] = vFlavors[i];
            }
            SafeArrayUnaccessData(psa);
         }

         V_VT(pvaVariant) = VT_ARRAY | VT_VARIANT;
         V_ARRAY(pvaVariant) = psa;

         return NOERROR;

   Error:
         for (i = 0; i < 3; i++)
         {
            if (V_BSTR(&vFlavors[i])
            {
               VariantClear(&vFlavors[i]);
            }
         }
         return hr;
   }
				
??? ?? ??? JSCRIPT ?? VBSARRAY.HTM ???? ?????? ??????? ??? ????? ????? ?? ??? ???????? ?????:
      <SCRIPT LANGUAGE=JSCRIPT>
      function JScriptSafeArrayTest()
      {
         pvaBstr = SimpleComponent.TestBstrs()
         if (typeof(pvaBstr) == "unknown")
         {
            Alert("JSCRIPT cannot handle the type returned by TestBstrs()")
            SimpleComponent.TestPassedArray(pvaBstr)
         }

         pvaVariant = SimpleComponent.TestVariants()
         if (typeof(pvaVariant) == "unknown")
         {
         Alert("JSCRIPT cannot handle the type returned by TestVariants()")
            SimpleComponent.TestPassedArray(pvaVariant)
         }
      }
      </SCRIPT>
				
??? ??? ??????? ?????, ??? ??????? ???????:

  1. ???? ????????? ????? ??? ?????? ??? ???? ????? VBSARRAY.DLL ?? ????? ?????? VBSARRAY.HTM.
  2. ????? ???? VBSARRAY.DLL ???????? ???? ??? REGSVR32.EXE.
  3. ??? ????? Internet Explorer ? ??????? ???????? ???? VBSARRAY.HTM.
  4. ???? ????????? ???? ???? ??? ?????? ?????? ??? ??? ????? ?? ?????? ?????? ??????.
?? ????? ???? ????? ???????? ??????? "????? ???? ??????" 2.1 ??? ?? ??? ?? 5.0 Visual C++ ?? Visual Studio ???? 97. ??? ??? ???? 97 Visual Studio ???? ????? ????? VBSARRAY ??????. ????? ????? ??? ????? ?????? ??? ????? VBSA.CPP ?? ?? ???? ?????? ????? ????? SAFEARRAY ?? ?? ?? VARIANT BSTR ???????. ????? ?? ????? ?? Cvbsa::TestVariants ? Cvbsa::TestBstrs ?? ????? ??????.

??????? ??????? ??? ?????? ??????? ?? "???? ??????? ?? Microsoft":
Vbsarray.exe
?????? ??? ??????? ?????? ??? ????? ????? ????? ??? Microsoft "? ???? ??? ??? ??????? ?????? ?????? ??" ????? ??????? ?? Microsoft:
119591????? ?????? ??? ????? ??? Microsoft ?? ??????? ??? ????????
???? Microsoft ???? ??? ????? ????? ?? ?????????. ??????? Microsoft ???? ?? ?????? ??? ??????? ??????? ??? ??????? ???? ?? ??? ?????. ??? ????? ????? ??? ?????? ????? ?????? ???? ????? ??? ??? ????? ??? ??????? ??? ???? ??? ??? ?????.

?????

???? ??????? SDK ?????? ???????

Microsoft Visual Basic Scripting ????? ??? Edition

???????

???? ???????: 165967 - ????? ??? ??????: 05/???? ??????/1435 - ??????: 4.2
????? ???
  • Microsoft Visual Basic, Scripting Edition 1.1
  • Visual Basic, Scripting Edition 2.0
  • Visual Basic, Scripting Edition 3.0
  • Microsoft JScript 1.0
  • Microsoft JScript 2.0
  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Active Server Pages 4.0
????? ??????: 
kbnosurvey kbarchive kbmt kbdownload kbfile kbprb kbsample KB165967 KbMtar
????? ????
???: ??? ????? ??? ?????? ???????? ?????? ????? ???? ????? ?????????? ????? ?? ????????? ?????? ????. ???? ???? ?????????? ???? ?? ???????? ???????? ?????? ????????? ????? ????????? ???????? ????? ???????? ?????? ?? ?????? ??? ?? ???????? ???????? ?? ????? ??????? ?????? ??? ??????? ?????? ??. ?????? ?? ???? ??? ??????? ???????? ????? ?? ???? ????? ?????? ??? ????? ??? ????? ??????? ?? ????? ?? ?????? ??? ??? ??????? ??????? ?? ????? ????? ????? ????? ?????. ?? ????? ???? ?????????? ??????? ??? ????? ?? ??????? ?? ????? ?????? ?? ??? ????? ?? ????? ??????? ?? ???????? ?? ??? ???????. ???? ???? ?????????? ???????? ??? ????? ?????? ??????? ??????
???? ??? ????? ??????? ?????? ??????????165967

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

 

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