copying text from the webpages or pdfs which are selected by mouse
-
im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.
-
im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.
-
Mouse and keyboard hooks will be of absolutely no use in retrieving text. (A keyboard hook might be of benefit, to trap the hotkeys however.)
It is a crappy thing, but it's life -^ Carlo Pallini
-
im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.
Have a look at this article: How to retrieve text under the mouse cursor[^]
It is a crappy thing, but it's life -^ Carlo Pallini
-
im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.
This is not an easy challenge. 1/ Detect the key being pressed! Keyboard hook, or a global hot key (see RegisterHotKey) which I'd recommend more. 2/ Then you have to get the window user the mouse. (RealChildWindowFromPoint) 3/ Then you have to extract the actual text. The way of doing this will vary from application to application. Firefox will be different from iexplore. FoxitReader will be different from Acrobat. 4/ You could get the pixel in the window, maybe using WM_PRINT, but then you'd have to OCR them to get the text... 5/ pdf and html viewers already have clipboard filling functions... It's a lot less work to use them! Good luck though, as this would be a major challenge to a pro. Maybe a semi-newbie who isn't afraid is the best person! Iain.
In the process of moving to Sweden for love (awwww). If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job! http://cv.imcsoft.co.uk/[^]
-
Mouse and keyboard hooks will be of absolutely no use in retrieving text. (A keyboard hook might be of benefit, to trap the hotkeys however.)
It is a crappy thing, but it's life -^ Carlo Pallini
umm! thanks for correcting. I will go through the link you provided.
You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_
-
im a semi newbie to MFC. Im developing an application where in i have to copy the text whereever my mouse navigates and selects some texts. It can be like i select some texts by the mouse cursor and then hit a hot key(ctr+T etc..)so that my Application reads the texts and dumpsand then further process the received texts. Can any one please suggest me that idea that what functions or classes i can use.
I am not 100% sure, but you can go in below way. 1) Register your hotkey (RegisterHotKey). 2) When hotkey pressed. a. get focused or current window handle using "WindowFromPoint" API b. send below message to window using handle to get text. WM_GETTEXT or EM_GETSELTEXT or EM_GETSEL
Parag Patel Sr. Software Eng, Varaha Systems