Capturing text from under your mouse cursor!

Ever felt the need to capture text from under your mouse cursor. I’ve made a small sample application which does this.

Check out!Download (Rename to exe or save as exe)

Take a look at this screenshot, notepad contents has been captured into my application’s value field. Name and value are two different things. For e.g. for an Address bar in internet explorer name will be “Address bar” and value will be “the address”.

Now you may ask why I needed this kind of an application or what’s the use of this application. It’s pretty useful if you want to capture text from a control in a module. I’ve heard people say that “if only there was some way to capture text in a listbox”.  This tool even captures hyperlinks, menu names, toolbars, button captions, edit text, static control text, list control text, list box text too. Isn’t that cool. 8)

Another cool feature that I found was if you hover your mouse over a progress bar then the text is shown as 20%. 😉 8)

Take a look at the checkboxes given…

  1. You can automatically copy captured text to clipboard when you release your mouse.
  2. You can also hide this window as soon as you start dragging.
  3. Along with above features you can also make this a top most window.
  4. Also added another check box for killing this application on mouse up. [update]

So have fun capturing text, log your bugs as comments. This application is a very basic one but turned out to be useful for me. I’ve used Accessibility APIs provided by Microsoft.

Sourcecode(zip file, please rename to zip or save as zip). Full credit to this blogger(OldNewThing).

Known bugs…

  1. Does not capture text from list control second column onwards
  2. Does not capture text in Microsoft word documents

49 thoughts on “Capturing text from under your mouse cursor!

  1. I’ve got a feeling whether it’s too big for the screen, should I make it smaller? Anyway it’s great to hear from you again, and thanks for those encouraging words!

  2. Hello,
    I like this program. Can I get the code ? I have been lookinf for information about capturing text under the cursor wihtout succes.

  3. Sorry for the late reply, thanks for your comments. I will send the source to your email. 🙂

    Email that you used in my blog for posting is it valid? 😕

  4. Hi Nibu, that’s a great utility – I’ve been trying to figure out how to do this for *ages*. Is there any chance you could share your source code with me?

  5. Nice tool. Can you send me the code as well? My mail address is correct. Maybe you should just publish it, since more people might be interested…

    Thank you very much

  6. Perfect solution for one of my projects, not only that it actually turns out to be one real nifty solution, can i get the source code …. my email address is correct and maybe you could publish it, no issues

  7. Hi,

    Great tool – I’m trying to do something similar; can you shoot me the sourcde code or explain the API calls that you used?



  8. Thanks for this piece of code, it’s great… could you send me it by email please (of course for non-commercial use, i filled mail-address field correctly)?


  9. Dear,
    I am hungry for the code. Would you please send it to me.
    Thank you so much.
    You – are my Angel!
    (My email is correct).

  10. Hi Nibu.

    Your application seems to be very good. Could I ask the source? I’m trying to do that, but no way to work for me..
    I wanna have a look about the way you done it!

    Thank you very much,
    Regards, Philippe

  11. Hey Emmet,

    The API that you mentioned is the heart of this application. It’s simple, I’ll shortly upload the source here for everyone, now I am short on time. 🙂


  12. The image “” cannot be displayed, because it contain errors.

    Im working on a student project
    aim is to display a text under a cursor
    i cant access to your exe.
    can you help me .?
    im doing it in basic C.
    can any API is der to be used.?

    • Sorry mithun, ít’s not an image file, it’s an executable. Due to wordpress blog limitations I’m not able to upload exe files, hence I’ve renamed it to png and then uploaded. You’ve got to save the file as exe. Right click and then select save target as…. option.

  13. Hi Nibu!

    I developed something like your app. But can’t capture text in Word or Excel window. Any ideas?

    With best regards,

  14. Hey Nibu!

    This is Awesome, great work! Tried this some time as well, but never reached your level. Could you please send me your code? My email is posted correctly.

    Thanks in advance and kind regards,

  15. Hi Nibu!

    Great software! In my work for uni we are developing special mouse and soft for blind peoples. Could you please send me ur code so we can learn?

    Thanks a ton!

  16. Hey.

    I try on my own to write something like you and that work great. That very easy infact but before to do this, i needed to understand how work window’s api.

    Then I’ve got some question about how to get the text in window’s application? Example in outlook, excel or word? As I can see I’ve just get the name of the object and not the text…

    Thank’s !

  17. Greetings! This is a small, lightweight app, but I can see the potential in it. I’m imagining a sort of “How-did-I-do-that-again?” list for IT professionals when trying to retrace their steps, i.e. “So I clicked this…entered this into the shell…then copied this file over to here…” – at least I see something like that 😛

    I know you’ve been asked many times before, but I was wondering if you could share the source to this gem. Although probably not the caliber of your work, I would be willing to post back any modifications (like the one mentioned above!) 🙂 My email is posted correctly! 🙂

    Cheers and keep up the good work!


  18. Hi Nibu,

    Awesome! I’ve been dying to find out how to do this! May I have your code? (my email’s correct)

    Thanks a lot!

  19. I’ve added sourcecode to this blog post as per the request from you guys. All the best and have fun! No copyrights, just a thank you message will do! 🙂

  20. Hello,
    I like this program. Great idea. Can I get the code ? I have been looking for information about capturing text under the cursor wihtout succes.

  21. There is memory leakage in code.
    IAccessible pointer is not getting Released.
    Even though we do ->Release() then aslo leakage is there.

  22. I am unable to set the Value in editable text in Mozilla Firefox browser using IAccessible put_accValue method. It returns error code NOT IMPLEMENTED.

    I want to programmatically set the contents of editable text boxes in Mozilla Firefox browser .
    How can I do it using MSAA ?

Appreciate your comments...