PDA

Click to See Complete Forum and Search --> : Capturing and Sending Key Presses


Dec 8th, 1999, 04:52 AM
I am workin in an environment that dous not provide the Key_Press event.

What I need is an API function that will capture all keys as they are pressed, check if the key is ENTER and if it is send the TAB
key.

Thanks in advance

Aaron Young
Dec 8th, 1999, 06:00 AM
You can use the GetAsyncKeyState API to check for vbKeyReturn, then you can send the Tab Key using the SendMessage API with the vbKeyTab Constant, or even use the VB function SendKeys.


------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

Dec 8th, 1999, 10:20 AM
Again,
I am not working in vb but a vb like language.
Can't use SendKeys.
And as I understand u need to have the GetAsyncKeyState function executed periodically to perform checking(need timer, don't have it). Is there a way to use GetMessage function to get keys.

Also, can you leave hWnds at zero(the environment does not provide hWnd to current window through its language).
I am not exactly sure but I think if they are zero Windooz will try to send message to all parent windows whether they like it or not, correct me if I am wrong.

Also could you give constants to use for SendMessage and GetMessage.

Thanks.

Aaron Young
Dec 9th, 1999, 12:08 AM
You don't neccessarily have to use a Timer Control, you could use a Do..Loop

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net

Dec 9th, 1999, 01:12 AM
The loop will hog the thread. and disallow me to continue other things, the environment can only do one task at a time.

Another related question.
if you shell a vb application that will keep track of those keys. How can you kill it.
Lets say it is a module only executable, no gui.

Aaron Young
Dec 9th, 1999, 01:50 AM
Use the Sleep API or DoEvents or even the Timer Function, to time when your Routine Executes.

You could terminate the Shelled App using the TerminateProcess API.

------------------
Aaron Young
Analyst Programmer
aarony@redwingsoftware.com
adyoung@win.bright.net