Link to home
Start Free TrialLog in
Avatar of furmiga
furmiga

asked on

How to press a key self ?

Well... this is not the if KeyPress thing..... Its like When whatever = whatever Press the Key :)
I really dont know if its possible what i need is:

A Delphi Program that see what other program( a full screen one ) do - done
When whatever = whatever ( at the Delphi program ) the Delphi program will press the key "1" i.e
Of corse that the Delphi program is running behind the main program so the "1" key will affect the main program.

Well... thats it.  Damn my english sux ( i am brazilian ) Sorry guys.....
 
ASKER CERTIFIED SOLUTION
Avatar of robert_marquardt
robert_marquardt

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of furmiga
furmiga

ASKER

Well... Almost there :) The problem is : It seams that the program cant act when the mais program( the full screen one ) is running. when the whatever = whatever the programn cant recieve the key but when I Alt+tab the and alt+tab again the mais program receives the key information....

dunno if u r understanding me :)

i am using

if i1 < 110 then
begin
  keybd_event( Ord('1'), MapvirtualKey( Ord('1'), 0), 0, 0 );
end;

Maybe cuz of the FullScreen stuff the program cant run or cant really press the key. dunno.
Avatar of furmiga

ASKER

Forget about it... i made it ! Thx for the comment i ll acept.
Hi, I think you have to write a Windows Hook function and install it on system so that hook function can monitor every key pressed in any program. Read Delphi Win32 API help, look for following function and read it carefully.

1. SetWindowHookEx
2. CallNextHookEx
3. UnHookWindowsHookEx