-
-
Save neremin/42088e68ed98b07b512af6c58e2f09b9 to your computer and use it in GitHub Desktop.
VBA_Test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Option Explicit | |
Declare PtrSafe Function DispInvoke Lib "OleAut32" _ | |
(ByVal arg1 As LongPtr, _ | |
ByVal arg2 As LongPtr, _ | |
ByVal arg3 As Long, _ | |
ByVal arg4 As Integer, _ | |
arg5 As Any, _ | |
arg6 As Variant, _ | |
arg7 As Any, _ | |
arg8 As Any) As Long | |
Const DISPATCH_METHOD = 1 | |
Sub hoge() | |
Dim rt As Variant | |
Dim dp(3) As LongPtr | |
Dim hr& | |
Dim ptr As LongPtr | |
ptr = VBA.CLngPtr(AddressOf func) | |
hr = DispInvoke(ptr, 0, 0, DISPATCH_METHOD, dp(0), rt, 0, 0) | |
Debug.Print Hex$(hr), rt | |
End Sub | |
Sub func() | |
MsgBox "test" | |
End Sub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment