View Single Post
Old 09-17-2004, 10:09 PM   #1 (permalink)
Stompy
Banned from being Banned
 
Location: Donkey
Win32 API Question about SendMessage & GETTEXT

I'm doing this from .NET, but I'm sure this problem is in standard C/C++ as well.

I'm having a hard time pulling text back from an object that contains more than 65k of text. I believe the magic # is 65535.

Here's the code I'm using (even if you don't know C#, it's still the same logic as in C/C++):

Code:
IntPtr txtLen = SendMessage(childCtrl, Vortex.WM_GETTEXTLENGTH, zeroval, zeroval);

					
StringBuilder text = new StringBuilder(txtLen.ToInt32() + 1);

SendMessage(childCtrl, Vortex.WM_GETTEXT, txtLen.ToInt32(), text);
System.Diagnostics.Debug.WriteLine(txtLen.ToString() + " - " + text.Length.ToString());
SendMessage is declared just fine, and it works until a certain point.

Say I'm pulling 65k of text back, once it gets past that, the "text" buffer seems to reset itself back to 0 and go from there. Once the thing is, say, 120k, the buffer, again, resets.

When it resets, it will only pull the first x chars from the window instead of the whole thing..

How do I snag ALL of the text in the window, or is that text size a limitation in the API?

I can watch the Debug.WriteLine section as the window's data gets bigger and bigger. The left number represents the size of data in the window while the right side is the size of the text after the API call. After the 65k, they no longer match and the right side resets.
__________________
I love lamp.

Last edited by Stompy; 09-17-2004 at 10:11 PM..
Stompy is offline  
 

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73