Modify ↓
Opened 15 years ago
Closed 15 years ago
#1466 closed Bug (Fixed)
_GUICtrlEdit_GetLine returns an unexpected character
Reported by: | ProgAndy | Owned by: | Jon |
---|---|---|---|
Milestone: | 3.3.5.5 | Component: | Standard UDFs |
Version: | 3.3.5.3 | Severity: | None |
Keywords: | Cc: |
Description
When using _GUICtrlEdit_GetLine, an unexpected character is appended. Here is the corrected function.
; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlEdit_GetLine ; Description ...: Retrieves a line of text from an edit control ; Syntax.........: _GUICtrlEdit_GetLine($hWnd, $iLine) ; Parameters ....: $hWnd - Handle to the control ; $iLine - Zero-based line index to get ; Return values .: Success - The line of text ; Failure - Empty string ; Author ........: Gary Frost (gafrost), Jos van der Zande <jdeb at autoitscript com > ; Modified.......: Gary Frost (gafrost) ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: Yes ; =============================================================================================================================== Func _GUICtrlEdit_GetLine($hWnd, $iLine) If $Debug_Ed Then __UDF_ValidateClassName($hWnd, $__EDITCONSTANT_ClassName) If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd) Local $iLength = _GUICtrlEdit_LineLength($hWnd, $iLine) If $iLength = 0 Then Return "" Local $tBuffer = DllStructCreate("short Len;wchar Text[" & $iLength & "]") Local $pBuffer = DllStructGetPtr($tBuffer) DllStructSetData($tBuffer, "Len", $iLength + 1) Local $iRet = _SendMessage($hWnd, $EM_GETLINE, $iLine, $pBuffer, 0, "wparam", "ptr") If $iRet = 0 Then Return SetError($EC_ERR, $EC_ERR, "") Local $tText = DllStructCreate("wchar Text[" & $iLength & "]", $pBuffer) Return DllStructGetData($tText, "Text") EndFunc ;==>_GUICtrlEdit_GetLine
Attachments (0)
Change History (1)
comment:1 Changed 15 years ago by Jon
- Milestone set to 3.3.5.5
- Owner changed from Gary to Jon
- Resolution set to Fixed
- Status changed from new to closed
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
Note: See
TracTickets for help on using
tickets.
Fixed by revision [5712] in version: 3.3.5.5