How to get text under mouse cursor using madCodeHook

c++ / delphi package - dll injection and api hooking
Post Reply
nduylinh
Posts: 4
Joined: Mon Nov 01, 2004 7:58 am

How to get text under mouse cursor using madCodeHook

Post by nduylinh »

Dear all,
I'm trying write a free dictionary program. I want my program suport "Click & See", but I don't know how to get text under mouse cursor using madCodeHook.
Please help me.
Thanks.
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

You'll need to hook text output APIs like TextOutA/W, ExtTextOutA/W, DrawTextA/W etc. Then you'll need to invalidate the area under your mouse cursor and check what text output APIs get called with which text.

This will fail if the text is a bitmap instead of real text. It will also fail if the text was drawn to an internal bitmap to avoid flickering (so called double buffering). But it should work fairly nice in a lot of cases.

It's not easy to do, though.
nduylinh
Posts: 4
Joined: Mon Nov 01, 2004 7:58 am

Post by nduylinh »

Dear madshi,
I known my program must capture TextOutA/W, ExtTextOutA/W, DrawTextA/W. But I don't know how to begin with madCodeHook, please give a sample code.
I think my program don't need to capture bitmap text.
Thanks for reply
madshi
Site Admin
Posts: 10764
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

There's lots of sample code about how to use madCodeHook in the "Demos" folder. Sure, there's no demo hooking text output APIs. Look, I can't build a demo for every single API out there. I simply don't have the time for that. Sorry...
nduylinh
Posts: 4
Joined: Mon Nov 01, 2004 7:58 am

Post by nduylinh »

Thanks madshi
I'll try to code.
Post Reply