Go Back  Xtreme Visual Basic Talk > Legacy Visual Basic (VB 4/5/6) > API > Get text under mouse cursor


Reply
 
Thread Tools Display Modes
  #1  
Old 06-07-2008, 12:18 AM
Empire Empire is offline
Newcomer
 
Join Date: Jun 2008
Posts: 11
Default Get text under mouse cursor


hi
I want get text under mouse cursor in any position and any window Like Babylon Dictionary Software .
I won't use any component to do this . I find some API functions but can't success.
Reply With Quote
  #2  
Old 06-07-2008, 12:37 AM
Cas's Avatar
Cas Cas is offline
Senior Contributor

* Expert *
 
Join Date: May 2008
Posts: 1,012
Default

Hi Empire, welcome to the forum!

Using GetCursorPos, WindowFromPoint and GetWindowRect, you can easily get the window under the cursor and the relative cursor position in that window, as you probably already figured out. Beyond that, though, I don't have much of an idea how to proceed, I'm afraid. You can look at the GetWindowText and InternalGetWindowText functions, or SendMessage WM_GETTEXT, but I'm pretty sure all of those give you only window and control captions and the like, rather than full content - and there's no way to correlate what you retrieve to the cursor position in the window. Maybe someone else will know better.
__________________

"Lying in bed would be an altogether perfect and supreme experience if only one had a colored pencil long enough to draw on the ceiling."

Chesterton, "Tremendous Trifles"
Reply With Quote
  #3  
Old 06-07-2008, 04:43 AM
Empire Empire is offline
Newcomer
 
Join Date: Jun 2008
Posts: 11
Default

Best regard for your attention.
I was used All API function that you ell me in your post (Except InternalGetWindowText ) but can 't write my desire program that work perfect.
I read about OCR Engine in some thread that some application use their own OCR engin to do this Like Babylon Dictionary.
Any body Know that How can use the OCR Engine of other program in our program??
Reply With Quote
  #4  
Old 06-07-2008, 07:13 AM
Cas's Avatar
Cas Cas is offline
Senior Contributor

* Expert *
 
Join Date: May 2008
Posts: 1,012
Default

Yes, taking a screenshot and using OCR might be your best bet. In general, you won't be able to use components of another program at all. Try looking for an OCR plugin, though - a very basic one would do, since a screenshot gives you perfect input quality. I'd be surprised if there weren't any free code available somewhere.
__________________

"Lying in bed would be an altogether perfect and supreme experience if only one had a colored pencil long enough to draw on the ceiling."

Chesterton, "Tremendous Trifles"
Reply With Quote
  #5  
Old 06-07-2008, 02:05 PM
mkaras's Avatar
mkaras mkaras is offline
Ultimate Contributor

Retired Leader
* Expert *
 
Join Date: Mar 2004
Location: Beaverton, OR
Posts: 1,874
Default

You could evaluate screen capture OCR through the use of the Kleptomania utility. A download to try it out is free. After you evaluate the techniques used you may decide to purchase the share-ware license for the package because it is such a handy interactive utility. Here is a link to the Kleptomania web site:

http://www.structurise.com/kleptomania/

If you find their OCR technology useful for your application it is possible to evaluate and purchase their core technology, which they call Textract. Read about it at this web page:

http://www.structurise.com/textract/index.shtml

Note that Textract is available with direct interfaces as a VB-Control or as an OCX.
Reply With Quote
  #6  
Old 06-07-2008, 09:31 PM
Empire Empire is offline
Newcomer
 
Join Date: Jun 2008
Posts: 11
Default

This is good but can't grab pdf text
Reply With Quote
  #7  
Old 07-21-2009, 07:25 AM
hoang3152003 hoang3152003 is offline
Newcomer
 
Join Date: Jul 2009
Posts: 1
Default

Hi You!
I am developing a dictionary application
I want to get text in cursor in other application when right click mouse in VB6.0 or C#
Please, help me a source code of this application and sent source code to my email : hoang.cntt@gmail.com
Thanks.
Hoang
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
 
 
-->