Below i am using this common readmemory function. Im calling the function like so

Code:
msgbox ReadMemory(hWnd, &H883221, 10)
However it just msg's a long number rather than a string, and i know theres a string at that address. Ive got to edit something in the functon and possible the way i call it, any ideas how?
thanks

Code:
Public Function ReadMemory(hWnd As Long, Address As Long, Bytes As Long, Optional strReplaceWith As String) As String
    'Runs For Not Unicode Strings (VB-Strings)
    On Error Resume Next
    Dim pId As Long        ' Used to hold the Process Id
    Dim pHandle As Long    ' Holds the Process Handle
    Dim bytValue As Long   'Stores the value of a byte in the memory
    Dim i As Long
    Dim Text As String
    Dim BytePass As Integer
   
    ' Get the ProcId of the Window
    GetWindowThreadProcessId hWnd, pId

    ' use the pId to get a handle
    pHandle = OpenProcess(PROCESS_ALL_ACCESS, False, pId)

    If (pHandle = 0) Then
         shpCon.FillColor = vbRed
         Timer1.Enabled = False
 
         Exit Function
    End If

    If Address = 0 Then Exit Function

    shpCon.FillColor = vbGreen
    Timer1.Enabled = True
    BytePass = Bytes
    If Bytes = 2 Then BytePass = 4
    For i = 1 To Bytes Step 2
       ' Read Byte to Byte
       
       ReadProcessMemory pHandle, Address + i - 1, bytValue, BytePass, 0&
       'value now contains the long value of the byte located in [Address + i - 1] pos.
       'ReadMemory is a string...
       '
   

       ReadMemory = bytValue

    Next
    'to write numeric values you can ..(Must) use WriteValue API
    If LenB(strReplaceWith) <> 0 Then
        'No Unicode!!
        WriteString pHandle, Address, StrPtr(strReplaceWith), LenB(strReplaceWith), 0&
    End If
    'Close the Handle
    CloseHandle pHandle
End Function