Click here to Skip to main content
15,881,938 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
Hi, guys!

I need to write an application that can highlight found text in active window of some process (as Text Spotlight tool). For example, I need to highlight text "abcd", so if current window is Excel, then all substring with "abcd" I need to highlight. The same effect is expected for WordPad, Skype etc.
I found way:
1. Hook active window change.
2. Find RichEdit class in this window and send message to this control.
3. Find Excel7 and _WwG windows of MS Office applications and invoke some methods from IDispatch.

The common problem - I think, that my way not good, because in this case I need to create special hooks for some process (one for Word, one for Excel etc). Maybe exists some universal way?

Thanks for any answers!
Posted
Comments
elgaabeb 29-Nov-11 8:42am    
I think that this is the way to do : access the components of each application you want to edit its text.
In my opinion you should have a customized procedure for each type of application for example Word, Excel ...
It sounds long task but this is it.
EL GAABEB.
Emilio Garavaglia 29-Nov-11 13:13pm    
If there was an universal way, anyone would have any existing credit card number!
Sergey Alexandrovich Kryukov 30-Nov-11 0:49am    
Good point! :-)
I would say: this is a bad task, should not be attempted to solve, just a waste of time.
--SA
Ram Shmider 10-Dec-11 15:46pm    
hi, I do not know if that will help, but if i am thinking about spy++ you can use the same function to enum the running windows,hold a list of the application you want to works on (re: word, excel sype...) and then go inner to get the common control that window has, if that common control is from class/type 'edit', get its text, do the hightlight process and set the text back, again i do not know if that helps, but you can give it a try, i check this to enable/disable other process buttons ( function to look at are: EnumProcessModules,EnumChildWindows,GetModuleFileNameEx,GetWindowInfo,GetClassName,GetWindowText).
Member 7984120 16-Jan-12 9:16am    
Thanks! You answer helped me a lot!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900