Handle of focused edit in another app?

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Handle of focused edit in another app?

Post by Roberto Lopez »

Hi All,

I'm dealing with a very tricky thing.

I'm working in an utility to solve a problem at work.

To achieve my goal, I must to know the handle of the focused editbox OF OTHER (non-HMG, closed-source) application.

I need the handle to paste something on it, and I cannot use simulated ctrl+v, since, at the time of required action, other special keys could be being pressed (alt or shift) making simulated ctrl+v, unusable.

But, knowing the destination handle, I could use SendMessage( nHandle , WM_PASTE ,0 ,0 ) to solve problem.

My utility will sit in system tray.

Any help is welcome.

TIA.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Pablo César
Posts: 4059
Joined: Wed Sep 08, 2010 1:18 pm
Location: Curitiba - Brasil

Handle of focused edit in another app?

Post by Pablo César »

Hola Roberto,

Aqui tenés un articulo que te puede ser util sobre este tema.

http://stackoverflow.com/questions/3522 ... ons-window

Un abrazo
HMGing a better world
"Matter tells space how to curve, space tells matter how to move."
Albert Einstein
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Handle of focused edit in another app?

Post by Roberto Lopez »

Pablo César wrote:Hola Roberto,

Aqui tenés un articulo que te puede ser util sobre este tema.

http://stackoverflow.com/questions/3522 ... ons-window

Un abrazo
Muchas Gracias!
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
User avatar
Roberto Lopez
HMG Founder
Posts: 4004
Joined: Wed Jul 30, 2008 6:43 pm

Re: Handle of focused edit in another app?

Post by Roberto Lopez »

Hi All,

I've found and alternate solution.

The solution is to simulate ctrl+v to paste on focused control, but, waiting (if required) that no special key (alt, shift, etc) is not being pressed, so, it works fine.

To achieve that, the only required thing is to test special keys with GetKeyState function, and wait (if required) until no other key is pressed before ctrl+v is inserted into keyboard.
Regards/Saludos,

Roberto


(Veritas Filia Temporis)
Post Reply