|
-
Dec 22nd, 2007, 12:28 PM
#1
Thread Starter
Addicted Member
vbCr and EM_GETLINE
Hi guys,
I really need help. This is what i try to do:
Code:
For i = 0 To lngCount
lngLength = SendMessage(hwnd, EM_LINELENGTH, i, 0)
strBuffer = Space$(lngLength)
Call SendMessageStr(hwnd, EM_GETLINE, i, ByVal strBuffer)
strRichText = strRichText & strBuffer
Next
MsgBox (strRichText)
The problem is :
the strRichtext don't concatenate the 2 or 3 lines together.
+ For some reason lngLength return max 109 event that the line is longer than that.
-
Dec 22nd, 2007, 12:53 PM
#2
Re: vbCr and EM_GETLINE
What's the source for your "lines"?
-
Dec 22nd, 2007, 12:59 PM
#3
Thread Starter
Addicted Member
Re: vbCr and EM_GETLINE
Sorry i don't get what do you mean source ? It's a richedit20a.
-
Dec 22nd, 2007, 01:03 PM
#4
-
Dec 22nd, 2007, 01:06 PM
#5
Thread Starter
Addicted Member
Re: vbCr and EM_GETLINE
lngLength = SendMessage(hwnd, EM_LINELENGTH, i, 0)
Return max 109
However if i set strBuffer = Space$(256) then i'll able to retreive up to 256 char on Call SendMessageStr(hwnd, EM_GETLINE, i, ByVal strBuffer)
-
Dec 22nd, 2007, 01:09 PM
#6
Thread Starter
Addicted Member
Re: vbCr and EM_GETLINE
nope it's not that i want to assign text, it's to retreive text. in the past, i'm able to use the WM_GETTEXT on that richedit however, there's alot of text now so i'll try an alternative way to get text to locate the last vbcr and get the last last beginning that line
-
Dec 22nd, 2007, 01:18 PM
#7
Thread Starter
Addicted Member
Re: vbCr and EM_GETLINE
temporary fix : strBuffer = Space$(1024) ' 
Hoppefully that the text it's no longer than 1024.
the strRichtext don't concatenate the 2 or 3 lines together. don't know why ?
Is Space(1024) use alot of memory ?
-
Dec 22nd, 2007, 01:22 PM
#8
Re: vbCr and EM_GETLINE
I believe line length is not dependent on vbCrLF. If a line contains 150 characters before vbCrLF but wordwrap occurs on the 90th character, then line length returned is 90, not 150.
Additionally, it appears you are not using EM_GetLine correctly. Per MSDN documentation
 Originally Posted by MSDN
lParam
A pointer to the buffer that receives a copy of the line. Before sending the message, set the first word of this buffer to the size, in TCHARs, of the buffer. For ANSI text, this is the number of bytes; for Unicode text, this is the number of characters. The size in the first word is overwritten by the copied line.
References:
EM_LineLength: http://msdn2.microsoft.com/en-us/lib...13(VS.85).aspx
EM_GetLine: http://msdn2.microsoft.com/en-us/lib...84(VS.85).aspx
-
Dec 22nd, 2007, 01:28 PM
#9
Re: vbCr and EM_GETLINE
 Originally Posted by LaVolpe
I believe line length is not dependent on vbCrLF...
It actually depends on either vbCr and vbLf but generally speaking vbNewLine is what should be used - it works better when data is exchanged between different platforms.
However, setting buffer length may not help - LaVolpe is absolutely right in his observation.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|