News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Win32 hookapi, mouse pointing and to get the text, did not work

Started by xiaolaba, May 23, 2018, 02:15:56 AM

Previous topic - Next topic

xiaolaba

hello, this new comer to this forum, looking for help or advice.

The goal to make a simple program, pickup the text by mouse pointing and send to editbox, the next goal will do some simple lookup for required information, something like dictionary application sort of that, however to develops the very own lookup table indeed.

References, some very old code on some webpage and does corrected some build script, a win32 program is able to run successfully but it does not come to promise for our goal as nothing show up.

The original win32 asm code, came with errors and no way to be assembled. Upon some reading and try & error, my build script and done for dll & exe.

The code and inital build, copy to GITHUB, https://github.com/xiaolaba/masm32_win10_screen_capture_text

jj2007

Hi xiaolaba,

Welcome to the forum :icon14:

GitHub is very clumsy for a small project. I have attached your source. It builds fine, but it does not run well.

Can you explain in a few words,
- what exactly the program should do?
- why you need the hook?

I suppose you use Google translate. Try to use short and simple phrases.

Greetings to Taiwan,
JJ

HSE

Welcome xiaolaba!

But you must know that if forum members upload all our code with errors it's possible to down Github servers  :biggrin:
Equations in Assembly: SmplMath

xiaolaba

hi there, thanks for warm greeting. :t
we are trying the best to make thing better as life is short.

xiaolaba

Quote from: HSE on May 23, 2018, 06:10:33 AM
Welcome xiaolaba!

But you must know that if forum members upload all our code with errors it's possible to down Github servers  :biggrin:

hi there, thanks for warm greeting. :t

we are trying the best to make thing better as life is short.

xiaolaba

Quote from: jj2007 on May 23, 2018, 02:57:45 AMHi xiaolaba,

Welcome to the forum :icon14:

GitHub is very clumsy for a small project. I have attached your source. It builds fine, but it does not run well.

Can you explain in a few words,
- what exactly the program should do?
- why you need the hook?

I suppose you use Google translate. Try to use short and simple phrases.

Greetings to Taiwan,
JJ

hi JJ, thanks for warm greeting. :t
the original author was saying, run the program, moving mouse elsewhere at point of some text, then the edit box will show you the exact text. such technique involve hook api and some microsoft published API and some non-documented.

Microsoft has app named bing dictionary, i.e. https://play.google.com/store/apps/details?id=bingdic.android.activity&hl=en_US
you may try and to grap the idea of how screen to text

others and description,
https://www.mjtnet.com/blog/2007/12/12/capturing-screen-text/
https://scialert.net/fulltextmobile/?doi=itj.2013.1668.1672

jj2007

From one of your links:
QuoteInterception of character output through API
Basic thinking of code interception: In order to achieve the interception of API such as ExtTextOutA/Ext TextOutW, a dynamically generated "JMP<replacement function>" instruction should be placed at the function entry and the JMP operand is the address of an intercepted replacement function which is provided (Richter, 2000). When the API is called, the JMP instruction will be executed firstly, jumping to the replacement function. Replacement functions are responsible for works like getting parameter from stack, calculating coordinate of the string, siphoning off words at the mouse position. After the execution is c ompleted, intercepted function will be called again by replacement function to finish normal character outputting and then turn back.

All that is not impossible, but a simple GetWindowTextW should be sufficient if the control behaves normally.
If the control does not behave normally, it will be complicated. And most browsers use controls that have little resemblance to normal edit or static controls. Perhaps they use GetTextOut, perhaps they don't...