I am using this to grab my text from external richtextbox. It works fine when theres not much text, but when I get alot of text, like 5000 characters, it seems to freeze up! It is getting the length correctly, so I'm not sure what the issue is.
Any suggestions? Basically I'm getting text from a richtextbox and displaying it in my textbox!
Dim length As IntPtr = SendMessage(ChatWindowHandler, WM_GETTEXTLENGTH, Nothing, 0)
Dim Hndl As IntPtr = Marshal.AllocHGlobal(length)
Dim NumText As Integer = SendMessage(ChatWindowHandler, WM_GETTEXT, length, Hndl)
'copy the characters from the unmanaged memory to a managed string
TextBox1.Text = Marshal.PtrToStringUni(Hndl)