Results 1 to 29 of 29

Thread: CopyMemory issue (WM_SETTEXT problem - ADVANCED) (SOLVED but still in Brainstorming)

Threaded View

  1. #1

    Thread Starter
    Lively Member Axonn's Avatar
    Join Date
    May 2005
    Posts
    64

    Resolved CopyMemory issue (WM_SETTEXT problem - ADVANCED) (SOLVED but still in Brainstorming)

    Hi everybody. I previously had some issues with WM_SETTEXT that are now fixed, thanks to some great help around here : ). I still have one more problem related to this though.... The problem is the CopyMemory function.

    I don't know how exactly can I retrieve from memory the text that I receive with the WM_SETTEXT message. I send this message from a VC++ Application. If I send a short message (under 10 characters or so) it works. If I send a really long message (more than 50 characters), the below code crashes.

    I think that "Len(lParam)" is not correct. Logically, that's a LONG so Len will always return 4 I guess. So how can I know how much memory to copy? It's a kind of recursive problem: I can't know how much memory to copy unless if I copy it and I can't copy it because I don't know how much to copy : |.

    Anybody got an idea about this?

    VB Code:
    1. Public Function TheSubclassedWndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long
    2.  
    3. Dim sString As String
    4.  
    5.     If uMsg = WM_SETTEXT Then
    6.         CopyMemory sString, lParam, Len(lParam)
    7.         MsgBox sString, vbInformation + vbSystemModal, "Trying to get the value"
    8.         Exit Function
    9.     End If
    10.    
    11.    TheSubclassedWndProc= CallWindowProc(loOriginalWindowProcedureAddress, hWnd, uMsg, wParam, lParam)
    12. End Function

    Thank you for reading anyway! : D.
    Last edited by Axonn; May 29th, 2005 at 04:18 AM. Reason: Problem solved
    . - = E C H Y S T T A S = - .
    The Greater Mind Balance

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width