urlwolf has asked for the wisdom of the Perl Monks concerning the following question:

I need to get the caret postion; Since I never did any Win32 programming before, I was wondering if this is something ultra-basic that the windows API has and I should be using that (from perl). I have a prototype in autohotkey; it fails getting caret position in GTK applications (like gvim). Is there a solid solution that works on any window, independent on what GUI library was used? Thanks perl windows dwellers.
  • Comment on Win32::API? I need to get the caret postion; never did any Win32 programming before

Replies are listed 'Best First'.
Re: Win32::API? I need to get the caret postion; never did any Win32 programming before
by BrowserUk (Patriarch) on Feb 09, 2008 at 08:08 UTC

    There is an API call to GetCaretPos(), but it is doubtful if it will be helpful to you.

    Each Win32 application (actually each message queue, but that's usually one to one), has it's own caret, and calling the API returns information applicable to the calling application. Ie. calling from Perl, which has a message queue, but doesn't use carets, it succeeds but always returns ( 0,0 ). This is true even if you arrange to have some other application brought to the top and be given the input focus before teh api is called.

    If you are trying to hook keystrokes, you are going to have to learn a great deal (more) about Win32 programming.


    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.
Re: Win32::API? I need to get the caret postion; never did any Win32 programming before
by Anonymous Monk on Feb 09, 2008 at 02:42 UTC
    There is no caret, there are only pixels.