in reply to Win32::GUI RichEdit: get absolute cursor position

The call you want is GetCaretPos().

I've no idea if Win32::GUI exposes that api -- nor even how you would go about finding out from the horrible docs they provide -- but I know it is exposed by Win32::GuiTest and that should give you what you need.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.

The start of some sanity?

  • Comment on Re: Win32::GUI RichEdit: get absolute cursor position

Replies are listed 'Best First'.
Re^2: Win32::GUI RichEdit: get absolute cursor position
by tomsell (Acolyte) on Aug 09, 2012 at 08:26 UTC

    Thanks for pointing out Win32::GuiTest which complements Win32::GUI quite nicely though GetCaretPos() comes up kinda empty.

    Anyway, the problem turned out to be my use of the wrong event handler. onMouseDown made GetSel() return erratic values. Asking GetSel() in the context of onMouseUp always returns the correct value for the insertion point.

    Win32::GUI docs: yeah, best to read the XS and MSDN...