Opened 6 years ago

Closed 6 years ago

#3628 closed Bug (Fixed)

_WinAPI_GetCaretPos() does not work

Reported by: anonymous Owned by: Jpm
Milestone: Component: AutoIt
Version: Severity: None
Keywords: winapi caret getcaretpos _WinAPI_GetCaretPos Cc:


_WinAPI_GetCaretPos() is supposed to return an array. It only returns 0.

#include <Debug.au3>
#include <WinAPIRes.au3>

_DebugSetup('Test', True)

$aCaret = _WinAPI_GetCaretPos()

_DebugReportVar('Caret:', $aCaret)

Error 998
Invalid access to memory location.

AutoIt:, OS: WIN_10/X64, OSLang: 0409

@@ Debug(9) : {Int32} -> Caret: = 0

Attachments (0)

Change History (2)

comment:1 Changed 6 years ago by Jos

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)
	Return $aResult
EndFunc   ;==>_WinAPI_GetCaretPos


Last edited 6 years ago by Jos (previous) (diff)

comment:2 Changed 6 years ago by Jpm

  • Milestone set to
  • Owner set to Jpm
  • Resolution set to Fixed
  • Status changed from new to closed

Fixed by revision [12145] in version:

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.

Add Comment

Modify Ticket

as closed The owner will remain Jpm.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.