Opened 7 years ago

Last modified 6 years ago

#3555 closed Bug

_GUICtrlRichEdit_StreamToVar with > 2048 characters — at Initial Version

Reported by: anthonyjr2 Owned by:
Milestone: Component: Standard UDFs
Version: 3.3.14.2 Severity: None
Keywords: Cc:

Description

This bug was discussed and solved here: https://www.autoitscript.com/forum/topic/188643-is-_guictrlrichedit_streamtovar-limited-to-2048-chars/

The problem happens when trying to stream a RichEdit with length > 2048 to a variable with _GUICtrlRichEdit_StreamToVar. The stream to file works correctly in this matter. The problem lies within this code which is called by the function:

Func GCR_StreamToVarCallback($iCookie, $pBuf, $iBuflen, $pQbytes)

#forceref $iCookie
Local $tQbytes = DllStructCreate("long", $pQbytes)
DllStructSetData($tQbytes, 1, 0)
Local $tBuf = DllStructCreate("char& $iBuflen &?", $pBuf)
Local $s = DllStructGetData($tBuf, 1)
$g_pGRC_sStreamVar &= $s
Return 0

EndFunc ;==>GCR_StreamToVarCallback

The buffer is not updated correctly at the end of the function. The solution is to add a line before the return statement and modify the earlier struct set:

Func GCR_StreamToVarCallback($iCookie, $pBuf, $iBuflen, $pQbytes)

#forceref $iCookie
Local $tQbytes = DllStructCreate("long", $pQbytes)
DllStructSetData($tQbytes, 1, $iBuflen) ;Modified this line
Local $tBuf = DllStructCreate("char& $iBuflen &?", $pBuf)
Local $s = DllStructGetData($tBuf, 1)
$g_pGRC_sStreamVar &= $s
DllStructSetData($tQbytes, 1, StringLen($s)) ;Added this line
Return 0

EndFunc ;==>GCR_StreamToVarCallback

This correctly updates the struct and solves the character limit.

Change History (0)

Note: See TracTickets for help on using tickets.