Click to See Complete Forum and Search --> : Highlighting text in ANY window?
Fangs78
May 19th, 2006, 06:10 AM
Hello.
This is my first post here at the forums.
I am currently messing around with textfetching and such in windows XP. Now I want to be able to highlight words that is of particular interest.
There is a program on the net called "Hilitext" that does this.
Http://www.fanix.com
I have spied a little on that program and it seems to send WM_NCPAINT messages to all open windows, and then bam, highligths the words that you wrote.
How on earth have they done this? Are they using DLL-injections? Is there any articles on catching the PAINT messages in a window and altering the text in them?
ANY hint is wildly appreciated! Been trying to do this for months now. It is driving me nuts :D
BTW, I've posted this in the GDI forum too. I was unsure where to post this....
JamesSchumacher
May 19th, 2006, 09:50 AM
They are probably using a third party tool to hook any windows API and are hooking all the text output functions. (TextOut, ExtTextOut, etc....)
After hooking these functions, they probably set the background mode to 'OPAQUE' (SetBkMode), and then set the the background color to whatever they want to hilite with. (SetBkColor). They have the DC handle because it's a parameter to the drawing functions. (Which they've probably hooked.)
I say this because not all windows have selectable sections and not all text is a label. (In fact, most of the time I do not use 'STATIC' controls due to flickering in updates - ExtTextOut in a mem DC works fine)
BTW... Sending the WM_NCPAINT message to the windows just causes them to repaint their window frame (see MSDN page at http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_8gdw.asp ) which in turn probably (I've never handled WM_NCPAINT before - WM_PAINT many a time though) causes the client to need updating, and therefore causes a WM_PAINT message to be sent. (And any text drawing function used will be 'hooked' as described above.)
That's what I would guess.
Fangs78
May 19th, 2006, 11:03 AM
Thanks for the response :)
I see they send a WM_NCPAINT and WM_PAINT message. I was guessing they hook into the message queue of the active programs and overriding the DrawText or TextOut functions for these programs.
Am I on the right track when I think that they use dll-injection to override these functions? Any tutorials around that do this? I have searched around a bit, but they mostly just handle the WM_PAINT messages of their own window.
I am already using functions ( AttachThreadInput etc) that hook into the messagequeue of a given application, which seems to work fine.
Can you "tag" text by overriding the TextOut or DrawText functions? Any tutorials or examples of the usage of this? I have only found tutorials that output text strings to a window, but I need to alter the text already there :)
Thanks again for the response!
JamesSchumacher
May 19th, 2006, 11:48 AM
After a little searching, I found the following article.
http://www.devx.com/Intel/Article/21023
FredStone
June 8th, 2006, 10:32 PM
You can use GetWord Component. http://www.hooksoft.net
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.