Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Option Explicit
Private Declare Sub RtlMoveMemory Lib "Kernel32.dll" (ByVal Destination&, ByVal Source&, ByVal length&)
Sub hoge()
Dim vtbl&()
Dim pVtbl&, pObj&, size&, i&
Dim unk As stdole.IUnknown
ReDim vtbl(0 To 25) '適当
size = (UBound(vtbl) + 1) * 4
Set unk = Application
pObj = ObjPtr(unk)
RtlMoveMemory VarPtr(pVtbl), pObj, 4
RtlMoveMemory VarPtr(vtbl(0)), pVtbl, size
For i = 0 To UBound(vtbl)
' Debug.Print Hex$(vtbl(i)); vbCrLf
Debug.Print vtbl(i); vbCrLf
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment