by Nokiocab25 (3 Submissions)
Category: Miscellaneous
Compatability: VB 6.0
Difficulty: Unknown Difficulty
Originally Published: Mon 6th January 2003
Date Added: Mon 8th February 2021
Rating: (1 Votes)
Pointer to a Function using the AddressOf Operator
API Declarations
' Techically pointers don't exist in VB, but there are ways to find an
' address of a function.
' This becomes important when using API's and Callback Procedures
Private Function DummyFunc(ByVal lParam As Long) As Long
DummyFunc = lParam
End Function
' A Function....
Private Function MyFunction() As Long
MyFunction = 0
End Function
' This Function will Return the Adrress of 'MyFunction'
Private Function GetAddress() As Long
GetAddress = DummyFunc(AddressOf MyFunction)
End Function