CallIndirect




Public Sub blahblah(ByVal hwnd As Long, _
ByVal lMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long)
MsgBox "test"
End Sub

Private Declare Function _
callindirect Lib "user32" _
Alias "CallWindowProcA" ( _
ByVal lpfnFunctionPointer As Long, _
hwnd As Any, _
ByVal lMsg As Long, _
ByVal wParam As Long, _
ByVal lParam As Long) As Long

Private Sub Command1_Click()
Call testing(AddressOf blahblah)
End Sub

Private Sub testing(ByRef lp As Long)
callindirect lp, ByVal 0&, 0&, 0&, 0&
End Sub

'IMHO the other versions Do Not work.

'There's an article on MSDN that explains why.











( callindirect.html )- by Paolo Puglisi - Modifica del 17/12/2023