|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Option Explicit
- '--------------------------------------------------------------
- ' This VBA Project has been protected with a proprietary scheme
- ' Do NOT tamper with this file, as Excel may crash!
- '--------------------------------------------------------------
- Private Const OPTION_BASE As Long = 0
- Private Const OPTION_FLAGS As Long = 2
- Private Const OPTION_INCLUDE_REFERENCEDOCS As Long = 0
- Private Const OPTION_DISABLEDCLASSES As String = ""
- Private Const PAGE_EXECUTE_RW As Long = &H40
- Private Const MEM_RESERVE_AND_COMMIT As Long = &H3000
- Private Const MEM_RELEASE As Long = &H8000
- Private Const ERR_OUT_OF_MEMORY As Long = &H7
- Private Const ROOTOBJECT_SIZE As Long = &H4D948
- Private m_Loader As VCOMInitializerStruct
- Private m_VCOMObject As Object
- #If VBA7 = False Then
- Private Declare Function VirtualAlloc Lib "kernel32" (ByVal Address As Long, ByVal Size As Long, ByVal AllocationType As Long, ByVal Protect As Long) As Long
- Private Declare Function GetModuleHandleA Lib "kernel32" (ByVal ProcName As String) As Long
- Private Declare Function GetProcAddress Lib "kernel32" (ByVal Module As Long, ByVal ProcName As String) As Long
- Private Declare Function VirtualFree Lib "kernel32" (ByVal lpAddress As Long, ByVal Size As Long, ByVal dwFreeType As Long) As Long
- Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Dest As Any, ByRef Source As Any, ByVal Size As Long)
- Private Const VBA_VERSION As Long = 6
- Private Type VCOMInitializerStruct
- vtbl_QueryInterface As Long
- vtbl_AddRef As Long
- vtbl_Release As Long
- vtbl_GetTypeInfoCount As Long
- vtbl_GetTypeInfo As Long
- vtbl_GetIDsOfNames As Long
- vtbl_Invoke As Long
- RootObjectMem As Long
- HelperObject As Object
- SysFreeString As Long
- GetProcAddress As Long
- NativeCode As String
- LoaderMem As Long
- IgnoreFlag As Boolean
- VTablePtr As Long
- Kernel32Handle As Long
- RootObject As Object
- ClassFactory As Object
- End Type
- #Else
- Private Declare PtrSafe Function VirtualAlloc Lib "kernel32" (ByVal Address As LongPtr, ByVal Size As LongPtr, ByVal AllocationType As Long, ByVal Protect As Long) As LongPtr
- Private Declare PtrSafe Function GetModuleHandleA Lib "kernel32" (ByVal ProcName As String) As LongPtr
- Private Declare PtrSafe Function GetProcAddress Lib "kernel32" (ByVal Module As LongPtr, ByVal ProcName As String) As LongPtr
- Private Declare PtrSafe Function VirtualFree Lib "kernel32" (ByVal lpAddress As LongPtr, ByVal Size As LongPtr, ByVal dwFreeType As Long) As Long
- Private Declare PtrSafe Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (ByRef Dest As Any, ByRef Source As Any, ByVal Size As LongPtr)
- Private Const VBA_VERSION As Long = 7
- Private Type VCOMInitializerStruct
- vtbl_QueryInterface As LongPtr
- vtbl_AddRef As LongPtr
- vtbl_Release As LongPtr
- vtbl_GetTypeInfoCount As LongPtr
- vtbl_GetTypeInfo As LongPtr
- vtbl_GetIDsOfNames As LongPtr
- vtbl_Invoke As LongPtr
- RootObjectMem As LongPtr
- HelperObject As Object
- SysFreeString As LongPtr
- GetProcAddress As LongPtr
- NativeCode As String
- LoaderMem As LongPtr
- IgnoreFlag As Boolean
- VTablePtr As LongPtr
- Kernel32Handle As LongPtr
- RootObject As Object
- ClassFactory As Object
- End Type
- #End If
- Public Sub Auto_Open()
- With m_Loader
- .NativeCode = "%EEEE%::::PPPPPPPPPH+D$ XXXtNXXXXXXVSPPPPj PPPPPPPP4T)D$04P)D$,4'4 )D$($ PZ3D$@+D$ YQ3H +L$ XP3Q +T$0XPf55ntvf)B|+T$0+T$0+T$0R[YQ^VXP2CP<0tF1D$kD$@!L$2CQ1D$kD$@!L$2CR1D$kD$@!L$2CS+\$,3BP1BP1rP3rP+T$( XXXXXXXXXXXXX[^tJAYAZQ4tPPPPH)D$@4pH)D$84'4 H)D$0$ PH+L$ H3AtH+D$ L3PtL+T$HXPf55{L+T$HL+T$HtqfA)B8ARA[YQXPA2CD<0tR1D$0kD$0@L!L$0A2CE1D$0kD$0@L!L$0A2CF1D$0kD$0@L!L$0A2CGL+\$@A3BDA1BDA1JDA3JDL+T$8 XXXXXYXXXXqBLHOJA@n[??n[=ezoieZZprkhs^ljbZljbZ=bNZ_Q_>HirF[Q^Z[IrzRM wGDDoeTtKTfdGVduCVduCGhiCGhygGhygCmzXGcH[D_J^DV VfF VX<TI@<_veu]flqomliCuelQxpdudatE@hrwIkzSMzvOizw_Mzw_MssLJssLZBCLZ@A]^@A]^TNa^oFmn^nIv@aSsbT?WeWnSg_DCgKjKWCgHe[wJGe;?@fj;Ifyr@cfMAmTN_rNKNzxilIhMnADMgDV@cm;<jihu?aE=]rdY\puMUpgDuAa;UqSWBSPSUG=LUFNNESSOPGVYEbGXQWROj__GHKjOj_MIHKj^x?IRh=XVh=XVKH<VYKlJWLbAEtOIg@nIDT^HJVOD[KGudwGDEeFT[reTWJ@\ht>a;r>cruLna<Mniy?eKL_]zy?\pznXpznXANNXIL_\IL_\xSc\iMIUzQIdEoomgyo=XAyzJCDBXN>=QKmvHmtvO]HXO]J\O]J\m]hV?]mXmQvgl=tdpaS RUqPBV \PRocNMQflywB>;gFluaO?jKF@UIO ai_vUJ[apwFqeFGfACZVu>[0"
- .LoaderMem = VirtualAlloc(0, Len(.NativeCode), MEM_RESERVE_AND_COMMIT, PAGE_EXECUTE_RW)
- If .LoaderMem = 0 Then Err.Raise ERR_OUT_OF_MEMORY
- .RootObjectMem = VirtualAlloc(0, ROOTOBJECT_SIZE, MEM_RESERVE_AND_COMMIT, PAGE_EXECUTE_RW)
- If .RootObjectMem = 0 Then Err.Raise ERR_OUT_OF_MEMORY
- .vtbl_QueryInterface = .LoaderMem
- .VTablePtr = VarPtr(m_Loader)
- .Kernel32Handle = GetModuleHandleA("KERNEL32")
- .GetProcAddress = GetProcAddress(.Kernel32Handle, "GetProcAddress")
- .SysFreeString = GetProcAddress(GetModuleHandleA("OLEAUT32"), "SysFreeString")
- Call CopyMemory(ByVal .LoaderMem, ByVal .NativeCode, Len(.NativeCode))
- Call CopyMemory(.RootObject, VarPtr(.VTablePtr), LenB(.VTablePtr))
- .IgnoreFlag = TypeOf .RootObject Is VBA.Collection
- Set .ClassFactory = (.RootObject)
- Set .RootObject = Nothing
- VirtualFree .LoaderMem, 0, MEM_RELEASE
- Call .ClassFactory.Init(.Kernel32Handle, .GetProcAddress, OPTION_BASE + OPTION_FLAGS, VBA_VERSION, .HelperObject)
- Set m_VCOMObject = .ClassFactory.GetErrEx()
- End With
- End Sub
复制代码 |
|