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:
Public Function TheSubclassedWndProc(ByVal hWnd As Long, ByVal uMsg As Long, ByVal wParam As Long, ByVal lParam As Long) As Long Dim sString As String If uMsg = WM_SETTEXT Then CopyMemory sString, lParam, Len(lParam) MsgBox sString, vbInformation + vbSystemModal, "Trying to get the value" Exit Function End If TheSubclassedWndProc= CallWindowProc(loOriginalWindowProcedureAddress, hWnd, uMsg, wParam, lParam) End Function
Thank you for reading anyway! : D.




Reply With Quote