- This topic has 13 replies, 2 voices, and was last updated 5 years ago by
pharaon.
-
AuthorPosts
-
July 31, 2015 at 10:44 am #66700
pharaon
MemberWarning: A StringBuilder buffer has been overflowed by unmanaged code. The process may become unstable. Insufficient capacity allocated to the StringBuilder before marshaling it.
i get this when i get last line in chat room
any suggestion to fix
August 1, 2015 at 9:14 am #66708pharaon
Memberthis is the code im using
Dim iLineIndex As Integer = SendMessage(hwnd, EM_LINEINDEX, ilastLine, 0) Dim iLineLength As Integer = SendMessage(hwnd, EM_LINELENGTH, iLineIndex, 0) if iLineLength = 0 return Nothing ' or return "" Dim sb As StringBuilder = New StringBuilder(iLineLength) sb.Append(ChrW(iLineLength)) sb.Length = iLineLength SendMessage(hwnd, EM_GETLINE, ilastLine, sb)
August 1, 2015 at 6:43 pm #66709Chike
AdministratorTry
<code>Dim sb As StringBuilder = New StringBuilder(iLineLength+1) sb.Append(ChrW(iLineLength+1))</code>
August 4, 2015 at 9:51 pm #66712pharaon
Memberstill give me the same error
August 5, 2015 at 6:19 am #66714Chike
AdministratorPost send message declarations
August 6, 2015 at 12:16 pm #66722pharaon
MemberDeclare Unicode Function SendMessage Lib "USER32" Alias "SendMessageW" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As StringBuilder) As Integer Declare Auto Function SendMessage Lib "USER32" (ByVal hwnd As IntPtr, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer
August 7, 2015 at 2:36 am #66723Chike
AdministratorCode should work, use debugger or post code example project that don’t work here
August 7, 2015 at 1:44 pm #66724pharaon
Memberit work but some times i give me this message A StringBuilder buffer has been overflowed by unmanaged code
August 7, 2015 at 10:31 pm #66729Chike
AdministratorI can’t debug for you, catch exception and make breakpoint there and see when it happens.
August 8, 2015 at 5:40 pm #66731pharaon
Memberthat is the exception i get
Warning: A StringBuilder buffer has been overflowed by unmanaged code. The process may become unstable. Insufficient capacity allocated to the StringBuilder before marshaling it.
August 9, 2015 at 6:52 am #66734Chike
AdministratorYes catch it and check all relevant parameters in code.
<code>Try SendMessage(hwnd, EM_GETLINE, ilastLine, sb) Catch ex As Exception MsgBox("SendMessage failed " & ex.Message) End Try</code>
Set breakpoint at MsgBox
August 14, 2015 at 3:11 pm #66745pharaon
Memberi did but couldn’t find any thing
August 15, 2015 at 6:55 am #66747Chike
AdministratorWhat all parameters ok and it fail?
August 15, 2015 at 11:38 pm #66750pharaon
Memberyes
-
AuthorPosts
- You must be logged in to reply to this topic.