hello everyone, i think im going to ask a very silly and noobie question but here it goes.

im using Visual Basic 6.0 and im trying to create a program that would detect keypresses over another program. then automatically press something else for me

say if i press f12 it should press the keys 1,2,3,4,5 for me

how do i do this? :cry:

hello everyone, i think im going to ask a very silly and noobie question but here it goes.

im using Visual Basic 6.0 and im trying to create a program that would detect keypresses over another program. then automatically press something else for me

say if i press f12 it should press the keys 1,2,3,4,5 for me

how do i do this? :cry:

You are going to have to create and apihook to watch for a whnd of any kind in any widow.

A good starting point would be here:

http://www.oreilly.com/catalog/subhookvb/chapter/ch01.html

Then get the logic of catching the keystrokes down.

Once you have done this I would suggest creating a small app to tell you how many windows are open and what are their names.

Store this in an array..

Then you have the api hook run for each whnd.

This will detect when ever a key is pressed.

We can safely assume that a user cannot press a key in two windows at the same time because one must have focus so this solution is valid.

This article has been dead for over six months. Start a new discussion instead.