Announcement

Collapse
No announcement yet.

Keyboard input

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Gregery D Engle
    replied
    Another way to do it would be to make a function and call

    GetAsyncKeyState with the appropriate virtual-key. It will
    be a lot more code but I think it will work. If you want to
    see if it's your main dialog just compare hwnd to GetTopWindow and
    that will tell you if it's your app or not.

    ------------------
    -Greg

    Leave a comment:


  • Tom Hanlin
    replied
    If you want the DO..LOOP to end, you have to supply an ending condition,
    use EXIT DO, or otherwise terminate the loop. As it stands, the loop is
    doing this:
    Code:
    OldStyle:
      getkeyboardstate pbkeystate
      if pbkeystate=0 then goto OldStyle
      goto OldStyle
    ------------------
    Tom Hanlin
    PowerBASIC Staff

    Leave a comment:


  • Jim Seekamp
    started a topic Keyboard input

    Keyboard input

    I'm trying to get the keyboard input from the main callback function
    of an application by calling the following function from a sub called
    by the callback function. The function never returns:

    function inkey() as string

    dim pbkeystate as byte

    do
    getkeyboardstate pbkeystate
    if pbkeystate<>0 then exit loop
    loop

    ip$=chr$(pbkeystate)

    function=ip$
    end function

    I also tried to grab the key press with WM_KEYDOWN and write it to
    a global variable, but that wouldn't return from a called function
    either. How do I get the keyboard input from my main window from
    a subroutine?

    Best Regards

    Jim



    ------------------
    Jim Seekamp

    [This message has been edited by Jim Seekamp (edited August 21, 2001).]
Working...
X