???? ID: 326651 - ????? ???????: 04 ?????? 2010 - ??????: 2.0

?????? ??? ?? ??? Visual Basic 2005 ?? Visual Basic .NET ??? ??-???? ??????? ?? ???????? ???? ?? ?? ActiveX ?????????? ?? ?????? ?? ??? ???? ????

?????? ??????This article applies to a different operating system than the one you are using. Article content that may not be relevant to you is disabled.

?? ????? ??

??? ?? ??????? ???? | ??? ?? ??????? ????

??????

?? ??? ?? ??? ???? ????? ???? ?? ?? ???? ?? ??-???? ??????? ??? Visual Basic 2005 ?? Visual Basic .NET ??? ?????? ??? ?? ???? ?? ?? ActiveX ???????? ?? ???????? ??? ?? ????? ?? ???? Visual Basic ??????? 6, ??? ?? ???????? ??? ?? ???? ???? ??????? ??????? ?????? ?? ????? ??Licenses.Add()?????? ??? ???? ?? ???? ??? ???? ??????? ?? ???License.Add()???? Visual ??? ?????? 6 ????? ?? ???? ?? "??????" ????

Visual Basic .NET ??? ?? Visual Basic 2005 ???, ?? ??????? ?????? ????? ??? ???????? ??? ??????? ??????? ?????? ???? ?????? ???

?? ???? ????? ?? ?? ??-???? ??????? ?? ???????? ?? ?? ???????? MyProject.OCX ??? ?? ?? MyLicensedControl ??? ??? MyProject.OCX ?? C:\Windows\System32 ??? ????? ???

??? ????? ??? .NET ?? Visual Basic 2005 ????????? ?????

  1. ????? ????,????????? ????? ????,??? ??????????? ????? ????,Microsoft Visual Studio .NET??,Microsoft Visual Studio 2005?? ????-????? ????, ?? ???? ???Microsoft Visual Studio .NET??,Microsoft Visual Studio 2005.
  2. ????? ???????????? ??,????? ????-????? ????, ?? ???? ????????????.
  3. ???????? ?????????????? ????? ???, ????? ????Visual Basic ??????????? ???????????????? ??????????? ????,Windows ??????????? ????????????????? ????-????? ????, ?? ???? ???OK.

    ???:Visual Studio 2005, ??? ????? ????Visual Basic?? ???????????????? ??????.

ActiveX ?????? Assemblies ?????

  1. ????? ????,????????? ????? ????,??? ??????????? ????? ????,Microsoft Visual Studio .NET??,Microsoft Visual Studio 2005?? ????? ????,????? Studio .NET ???????,????? Studio 2005 ??????? ????-????? ????, ?? ???? ???????? Studio .NET ????? ???????????,????? Studio 2005 ????? ?????????.
  2. ????? ?? ??? ?? ?????? assemblies ?? ???? ?????, ?? ????? ??????? ???? ????:
    aximp /out:C:\temp\AxMyProject.dll "C:\Windows\System32\MyProject.ocx"
    AxMyProject.dllAxHost Interop ?? ??? ???MyProject.dllCOM Interop ?? ??? ???

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

  1. ????? ????????????????? ??,?????? ??????.
  2. ????? ????,???????, ?? ???? ??? ???? ?????? ??? ???? ?? ActiveX ???????? Interop assemblies ?? ??? ???? (?? ??? ???? ????? C:\Temp)?
  3. AxMyProject.dll ?? MyProject.dll ??????; ?? ??????? ?? ?????? ???????? ?????? ??????? ??? ?? ?????? ?????
  4. ????? ??????????????? ???? ?? ??? ????????
  5. ??? ?? ??? ?????? ?? ??? ??? ?? ???-????? ??????? ????? ????? ?????????? ???
  6. ???????? ????? ????? ???????? ?? ???, ????? ??? ???????:
      Dim myControl As New AxMyProject.AxMyLicensedControl()
    						
    ?? AxHost ?? ?????? ?? ???????? ?? ?? ?? ??????? ????? ???

    ???:: ???? ??? COM (??? MyProject.MyLicensedControl), ?? ?????? ?? ???????? ?? ?? ?? ??????? ??????? ?? ??????? ?? ??? ???? ?????, ?? ?? ????? ?? ??????? ???? ???? ?? ?????

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

  1. ????????? ???? ?? ???????? ?? ??? ??-???? ??????? ????? ?? ??? ????? ?? ???MyLicensedControl, ??????? ????? ?? "gnvlslnjskvlmlgnnimh" ???
  2. ???????? ????? ????? ???????? ?? ???, ???? ??? ?? ????? ??? ????????? ??? ??? ?? AxMyProject.AxMyLicensedControl() ??? myControl:
            Dim f As System.Reflection.FieldInfo
            f = GetType(AxHost).GetField("licenseKey", _ 
                Reflection.BindingFlags.NonPublic _ 
                Or Reflection.BindingFlags.Instance)
            f.SetValue(myControl, "gnvlslnjskvlmlgnnimh")
    					
    ?? ??? ??-???? ??????? ??? ???????? ???????? ???? ??? ?? ?? ??????? ?? ????? ??FieldInfo, ?? ??? ??? ?? ??? ??OCXState. ?? ??? ??? ActiveX ???????? ?? ??????? ??????? ?? ??? ??? ??? ??????? ?? ?????? ???, ?? ??? ???? ?????licenseKey?? ?? ??? ?? ??????myControl. ?? ?? ??-???? ??????? ?? ??? ?????? ??? ActiveX ???????? ?? ???????? ???????? ?? ??? ?? ??? ???? ???? ??????

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

  1. ??????? ???????? ?????? ???? ?? ??? ???????? ?????, ?? ???? ??? ???????? ??????? ??? ???? ?? ???, ?? ????? ??? ?? ????? ?? ???? ???:
            Controls.Add(myControl)
            myControl.Show()
    						
    ?? ??? ??? ?????????? ????? ????? ????????, "f.SetValue (myControl,"gnvlslnjskvlmlgnnimh")" ?? ???, ?? "?? ?????? ????" ?????? ?? ?????

    ???:: ??? ??????? ???????? ??? ???? ????? ??? ?? ?? ??????? ?? ???????? ??, ??Controls.Add???? ?? ??????Controls.Add??? ?? ?????? ?? ??????? ?? ??????? ?? ????? ??? ?? ?? ?? ?????? ???? ?? ?????Controls.Add, ?? ???? ??? ??? ????? ?????? ?????:
    'System.ComponentModel.LicenseException' ??? ???????? ??????? system.windows.forms.dll ?? ?? ?????? ?? ??? ????? unhandled: ?? ?? ActiveX ???????? ?? ????? ???? ?? ??? ??? ??????? ???? ???
    ??, ????? ??? ?? ?? ????? ???? ?????? ????? ??? ???? ???:
    ???? ????????? ??? unhandled ????? ??????? ???? ???? ??? ?? ActiveX ???????? ?? ????? ???? ?? ??? ??? ??????? ???? ???
  2. ????????? ?? ????? ?? ??? F5 ?????..
  3. ??????? ?? ???? ActiveX ???????? ?? ?????? ?? ??? ??? ????? ?????

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

??????????: ?? ???????? ?? ???? ??? ????? ?? ????? ???:
  • ???????? ActiveX ?? ???????? ???????? ?? ??? ??????? ?????? ?????? ???????? ?? ?? ??-???? ??????? ?? ???????? ??? ?????? ?? ???, ??? ?? ????? ?? ??? ????? ??????MyLicensedControl, ?????? ?? ??? ??????? ?? ?????? ?? ????
  • ????????? ???? ?? ???? ???????? ?? ??? ??? ??????? ????? ??? ??? ??????? ????? ???????? ???????? ?? ??? ??????? ??:????? ?? ???????? ???? ?? ???? ??? ???????? ??????? ?? ??? Microsoft ???????? ??? ???? ????? ?? ??? ????? ???? ?????? ?? ????? ????:
    151771  (http://support.microsoft.com/kb/151771/EN-US/ ) LICREQST.EXE ?? ???????? ??? ?? ?? ??????? ????? ?? ?????? ?? ??? ??
    ???????? ??? ??, ?? ????? ?? ???? ???Licenses.Add???????? ?? ??? Visual Basic 6 ??? ????????? ??? ??????? ?? ?? ???? ???????? ???Licenses.Add??-???? ???? ??????? ?? it ?? ???????? ?? ??? ??? ????? ???; ?? ????? ?? ?? ???? ???Debug.print??????? ????? ??????? ?????

??????

???????? ??????? ?? ??? ?????? ?? Microsoft ???????? ??? ????? ?? ??? ????? ???? ???????? ?? ????? ????:
241126  (http://support.microsoft.com/kb/241126/EN-US/ ) ?????: ?????? ??? ?? UserControls ??-???? ??????? ?????? ?? ?????
188577  (http://support.microsoft.com/kb/188577/EN-US/ ) HOWTO: ???? ?? ??????? ?????? ????? ????
190670  (http://support.microsoft.com/kb/190670/EN-US/ ) HOWTO: ?????? ??? ?? ????? ???????? ???? ?? ??? Visual Basic 6.0 ?? ??? ??? ???????

???? ???? ???? ??:
  • Microsoft Visual Basic 2005
  • Microsoft Visual Basic .NET 2003 Standard Edition
  • Microsoft Visual Basic .NET 2002 Standard Edition
??????: 
kbvs2005swept kbvs2005applies kbhowtomaster kbmt KB326651 KbMthi
???? ?????? ???????????? ?????? ????????
??????????: ?? ???? ?? ???? ??????? ?? ????? ?? Microsoft ????-?????? ?????????? ?????? ?????? ???? ??? ??. Microsoft ???? ??? ????-???????? ?? ????-???????? ????? ?????? ?? ???? ???????? ???? ?? ???? ????? ????? ??? ?? ??? ?????? ?? ???? ???? ???? ??? ????? ??. ???????, ????-???????? ???? ????? ???? ???? ???? ???. ?????, ????????, ?????-???? ?? ??????? ?? ???????? ?? ???? ???, ???? ?? ??? ?????? ???? ???? ??? ????? ??? ?? ???? ??. Microsoft ??????? ??? ???? ?? ?????? ?? ??????????, ????????? ?? ??? ?????? ?? ???? ????? ?? ???? ???????? ?? ??? ???? ????? ?? ??? ????????? ???? ??. Microsoft ????-?????? ?????????? ?? ????? ?????? ?? ?? ??? ??.
?????????? ?? ??????? ????????? ??????? ??:326651  (http://support.microsoft.com/kb/326651/en-us/ )