Declare Function CallWindowProc& Lib "user32" _
Alias "CallWindowProcA" (ByVal lpPrevWndFunc&, _ ByVal hWnd&, ByVal Msg&, ByVal wParam&, _ ByVal lParam&) Declare Sub CopyMemory Lib "kernel32" _ Alias "RtlMoveMemory" (lpvDest As Any, _ lpvSource As Any, ByVal cbCopy As Long) Option Explicit '____________________________________________________________ Private Function StripStringFromPointer$(ByVal lpString&, _ ByVal nStrLen&) Dim Info$ Info = String$(nStrLen, vbNullChar) CopyMemory ByVal StrPtr(Info), ByVal lpString, nStrLen * 2 StripStringFromPointer = Info End Function '____________________________________________________________ Private Function GetAddress(Addr&) GetAddress = Addr End Function '____________________________________________________________ Private Function MyFunction&(ByVal lpString&, _ ByVal nStrLen&, ByVal param3&, ByVal param4&) Debug.Print StripStringFromPointer(lpString, nStrLen) End Function '____________________________________________________________ Public Sub Main() Dim FunctAddr&, Info$ Info = "Holy Smoke" FunctAddr = GetAddress(AddressOf MyFunction) CallWindowProc FunctAddr, StrPtr(Info), CLng(Len(Info)), 0&, 0& End End Sub |