Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Waitforkeys method

Waitforkeys method

Waitforkeys method

Does anybody knows how does the Waitforkeys method works?
I'm developing an application in VB that interacts with an Extra 3270 emulation.
I needed to wait any key in the Extra 3270 emulation to be pressed. But when the key is pressed I need to know which was the key that the user pressed.

If think the right way to do it is writting the sentence:


When I execute this sentence the result is that it detects when any key is pressed but the variable "keypressed" is empty.

Does anybody know if there's any way to make what I need?

RE: Waitforkeys method

I have used the hllapi Function 50: Start Keystroke Intercept to complete this task. Basically this function will intercept any keystroke the user presses. The only draw back is that you must handle each of the keys you are looking for. Hope that helps.

RE: Waitforkeys method

Here is what is included in the 6.7 version 'Help' manual.

Applies To Objects



Waits until the user presses a key or for the specified time to elapse before the program will continue processing.


rc = object.WaitForKeys ([Timeout [,UserKeys]])
object.WaitForKeys [Timeout [,UserKeys]]

Element    Description
rc    The return value.
object    The Screen object.
Timeout    The time for the Screen object to wait, in milliseconds. If no timeout value is specified, the Screen object waits until a key is pressed.
UserKeys    One or more keys that the user must press for the program to continue processing. If no string is specified, any keystroke will continue program processing.
Return Value    Description
UserKeys    The UserKeys keys that the user pressed.
empty string    Indicates that no key was pressed within the specified time or that the key that the user pressed was not one of the UserKeys you supplied in the WaitForKeys method syntax.

Copyright 1996 - 2000, Attachmate Corporation. All rights reserved.

* Here is an example from the 'Help' manual.

The example waits for the user to press the "a" character or for nine seconds to elapse.

Sub Main()
    Dim Sys As Object, Sess As Object, MyScreen As Object

    Set Sys = CreateObject("EXTRA.System")
' Assumes an open session
    Set Sess = Sys.ActiveSession
    Set MyScreen = Sess.Screen

    ' Method 1: As set in TimeoutValue property,
    ' WaitForKeys will wait for nine seconds until
    ' the "a" key is pressed
    Sys.TimeoutValue = 9000
    Wait4Keys$ = MyScreen.WaitForKeys("a")
    MsgBox "WaitForKeys returned " + Wait4Keys$ + "."

    ' Method 2: As set in the Timeout parameter,
    ' WaitForKeys will wait for nine seconds until
    ' the "a" key is pressed

Wait4Keys$ = MyScreen.WaitForKeys(9000, "a")
    MsgBox "WaitForKeys returned " + Wait4Keys$ + "."
End Sub

Copyright 1996 - 2000, Attachmate Corporation. All rights reserved.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close