﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
3555	_GUICtrlRichEdit_StreamToVar with > 2048 characters	anthonyjr2		"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."	Bug	closed		Standard UDFs	3.3.14.2	None	Works For Me		
