Getting the process Id
In order to open the other process to read it's memory you need to know the process id. You can get this if you have the window handle of the window that sent you the message thus:-

VB Code:
  1. Private Declare Function GetWindowThreadProcessId Lib "user32" (ByVal hwnd As Long, lpProcId As Long) As Long
  2.  
  3. Public Function ProcessIdFromHwnd(ByVal hwnd As Long) As Long
  4.  
  5. Dim lProc As Long
  6. If GetWindowThreadProcessId(hwnd, lProc) Then
  7.     ProcessIdFromHwnd = lProc
  8. End If
  9.  
  10. End Function

And you pass this in to OpenProcess in order to get the hProc parameter to pass to LongFromOutOfprocessPointer and StringFromOutOfprocessPointer...

VB Code:
  1. Public Enum ProcessAccessPriviledges
  2.      PROCESS_TERMINATE = &H1
  3.      PROCESS_CREATE_THREAD = &H2
  4.      PROCESS_SET_SESSIONID = &H4
  5.      PROCESS_VM_OPERATION = &H8
  6.      PROCESS_VM_READ = &H10
  7.      PROCESS_VM_WRITE = &H20
  8.      PROCESS_DUP_HANDLE = &H40
  9.      PROCESS_CREATE_PROCESS = &H80
  10.      PROCESS_SET_QUOTA = &H100
  11.      PROCESS_SET_INFORMATION = &H200
  12.      PROCESS_QUERY_INFORMATION = &H400
  13.      PROCESS_SYNCHRONISE = &H100000
  14.      PROCESS_ALL_ACCESS = &H100FFF
  15. End Enum
  16. Private Declare Function OpenProcess Lib "kernel32" (ByVal dwDesiredAccess As ProcessAccessPriviledges, ByVal bInheritHandle As Long, ByVal dwProcessId As Long) As Long