﻿id	summary	reporter	owner	description	type	status	milestone	component	version	severity	resolution	keywords	cc
1441	_GUICtrlRichEdit_GetText: last character truncated	ProgAndy	Jon	"_GUICtrlRichEdit_GetText sets the length of the string-buffer incorrect. This results in a missing character at the end of the string. 

This is the fixed function:
{{{
; #FUNCTION# ====================================================================================================================
; Name ..........: _GUICtrlRichEdit_GetText
; Description ...: Get all of the text in the control
; Syntax ........: _GUICtrlRichEdit_GetText($hWnd[, $fCrToCrLf = False[, $iCodePage = 0[, $sReplChar = """"]]])
; Parameters ....: $hWnd 			- Handle to control
;                  $fCrToCrLf - Convert each CR to a CrLf (Optional)
;                  |True - do it
;                  | don't (Default)
;                  $iCodePage - code page used in translation (Optional)
;                  |Default: use system default
;                  |CP_ACP for ANSI, 1200 for Unicode
;                  $sReplaChar - Character used if $iCodePage is not 1200 and a wide character cannot be represented in
;                  +specified code page (Optional)
; Return Values. : Success -	the text
;                  Failure - """" and sets @error:
;                  |101 - $hWnd is not a handle
;                  |102 - $fCrToCrLf must be True or False
;                  |103 - $iCodePage is not a number
;                  |700 - internal error
; Authors........: Prog@ndy
; Modified ......: Chris Haslam (c.haslam), jpm, Prog@ndy
; Remarks .......: On success, if $sReplChar set, @extended contains whether this character was used
;+
;                  Call _GUICtrlRichEdit_IsModified() to determine whether the text has changed
; Related .......: _GUICtrlRichEdit_SetText, _GUICtrlRichEdit_AppendText, _GUICtrlRichEdit_InsertText, _GUICtrlRichEdit_IsModified
; Link ..........: @@MsdnLink@@ EM_GETTEXTEX
; Example .......: Yes
; ===============================================================================================================================
Func _GUICtrlRichEdit_GetText($hWnd, $fCrToCrLf = False, $iCodePage = 0, $sReplChar = """")
	If Not IsHWnd($hWnd) Then Return SetError(101, 0, """")
	If Not IsBool($fCrToCrLf) Then Return SetError(102, 0, """")
	If Not __GCR_IsNumeric($iCodePage) Then Return SetError(103, 0, """")

	Local $iLen = _GUICtrlRichEdit_GetTextLength($hWnd, False,True) + 1
	Local $sUni=''
	If $iCodePage=$CP_UNICODE Or Not $iCodePage Then $sUni=""w""
	Local $tText = DllStructCreate($sUni & ""char["" & $iLen & ""]"")

	Local $tGetTextEx = DllStructCreate($tagGETTEXTEX)
	DllStructSetData($tGetTextEx, ""cb"", DllStructGetSize($tText))

	Local $iFlags = 0
	If $fCrToCrLf Then $iFlags = $GT_USECRLF
	DllStructSetData($tGetTextEx, ""flags"", $iFlags)

	If $iCodePage = 0 Then $iCodePage =  $CP_UNICODE
	DllStructSetData($tGetTextEx, ""codepage"", $iCodePage)

	Local  $pUsedDefChar = 0, $pDefaultChar = 0
	If $sReplChar <> """" Then
		Local $tDefaultChar = DllStructCreate(""char"")
		$pDefaultChar = DllStructGetPtr( $tDefaultChar, 1)
		DllStructSetData( $tDefaultChar, 1, $sReplChar)
		Local $tUsedDefChar = DllStructCreate(""bool"")
		$pUsedDefChar = DllStructGetPtr( $tUsedDefChar, 1)
	EndIf
	DllStructSetData($tGetTextEx, ""lpDefaultChar"", $pDefaultChar)
	DllStructSetData($tGetTextEx, ""lpbUsedDefChar"", $pUsedDefChar)

	Local $iRet = _SendMessage($hWnd, $EM_GETTEXTEX, DllStructGetPtr($tGetTextEx), DllStructGetPtr($tText))
	If $iRet = 0 Then Return SetError(700, 0, """")
	If $sReplChar <> """" Then SetExtended(DllStructGetData($tUsedDefChar, 1) <> 0)
	Return DllStructGetData($tText, 1)
EndFunc   ;==>_GUICtrlRichEdit_GetText
}}}"	Bug	closed	3.3.5.4	Standard UDFs	3.3.5.1	None	Fixed		
