Archive: Error 998 Invalid Access Memory Location


Error 998 Invalid Access Memory Location
'm trying to call the GetCaretPos function in User32.dll from an NSIS installer, and the only thing I can seem to get is an invalid access to memory location error.

Here is my code:

Function fixUpRegKeyText
Exch $0 ; HWND to text box
Push $1 ; text of edit box
Push $2 ; pointer to point structure
Push $3 ; getlasterror result


System::Alloc 16 ;struct { long x, long y }
pop $2
;messageBox MB_OK $2
;get the caret position
System::Call "User32::GetCaretPos(p .r2) i.. ? e"
pop $3

messageBox MB_OK $3 ; 998!

${NSD_GetText} $0 $1

Push $1
call StrUpper
Pop $1

${NSD_SetText} $0 $1

; now set the caret position
;System::call "user32::SetCaretPos(p s.) i .."

Pop $3
Pop $2
Pop $1
Pop $0
FunctionEnd


Anyone see any problems with what i'm doing here?

The p pointer type does not work in 2.46, use i. (Use your offline helpfile, the online helpfile has features only available in SVN)

Also, GetCaretPos needs the input, not just output