Click here to Skip to main content
13,045,019 members (44,294 online)
Rate this:
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
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.
Emilio Garavaglia 29-Nov-11 13:13pm
If there was an universal way, anyone would have any existing credit card number!
SAKryukov 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.
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)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web02 | 2.8.170713.1 | Last Updated 29 Nov 2011
Copyright © CodeProject, 1999-2017
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