Created
December 28, 2014 23:26
-
-
Save kumatti1/ddb722323703c5e11c59 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