Modify ↓
Opened 7 years ago
Closed 7 years ago
#3628 closed Bug (Fixed)
_WinAPI_GetCaretPos() does not work
| Reported by: | anonymous | Owned by: | Jpm |
|---|---|---|---|
| Milestone: | 3.3.15.1 | Component: | AutoIt |
| Version: | 3.3.14.5 | Severity: | None |
| Keywords: | winapi caret getcaretpos _WinAPI_GetCaretPos | Cc: |
Description
_WinAPI_GetCaretPos() is supposed to return an array. It only returns 0.
#include <Debug.au3>
#include <WinAPIRes.au3>
_DebugSetup('Test', True)
$aCaret = _WinAPI_GetCaretPos()
_WinAPI_ShowLastError()
_DebugReportVar('Caret:', $aCaret)
Error 998
Invalid access to memory location.
AutoIt: 3.3.14.5/X64, OS: WIN_10/X64, OSLang: 0409
@@ Debug(9) : {Int32} -> Caret: = 0
Attachments (0)
Change History (2)
comment:1 Changed 7 years ago by Jos
comment:2 Changed 7 years ago by Jpm
- Milestone set to 3.3.15.1
- Owner set to Jpm
- Resolution set to Fixed
- Status changed from new to closed
Fixed by revision [12145] in version: 3.3.15.1
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.

Looks like there is an error in the _WinAPI_GetCaretPos() UDF where the pointer used in the DllCall not the struct created ($tPOINT) but the string with the struct definition ($tagPOINT).
COuld you try this update:
Func _WinAPI_GetCaretPos() Local $tPOINT = DllStructCreate($tagPOINT) Local $aRet = DllCall('user32.dll', 'bool', 'GetCaretPos', 'struct*', $tPOINT) If @error Or Not $aRet[0] Then Return SetError(@error + 10, @extended, 0) Local $aResult[2] For $i = 0 To 1 $aResult[$i] = DllStructGetData($tPOINT, $i + 1) Next Return $aResult EndFunc ;==>_WinAPI_GetCaretPosJos