Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to 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 29-Nov-11 2:37am
Comments
elgaabeb at 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 at 29-Nov-11 13:13pm
   
If there was an universal way, anyone would have any existing credit card number!
SAKryukov at 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 at 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 at 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)

  Print Answers RSS
0 OriginalGriff 328
1 Sergey Alexandrovich Kryukov 295
2 Gihan Liyanage 292
3 ClimerChinna 222
4 Abhinav S 187
0 Sergey Alexandrovich Kryukov 8,213
1 OriginalGriff 7,089
2 CPallini 2,598
3 Richard MacCutchan 1,925
4 Abhinav S 1,778


Advertise | Privacy | Mobile
Web04 | 2.8.140826.1 | Last Updated 29 Nov 2011
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100