Results 1 to 9 of 9

Thread: Vk_escape = &h1b

  1. #1

    Thread Starter
    Member susn's Avatar
    Join Date
    Feb 2001
    Location
    Dubai
    Posts
    48

    Angry

    I try to close my App with the Escape Key, but is'nt working .....
    I do this in a Module:
    Option Explicit
    Public Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer

    Public Const VK_ESCAPE = &H1B
    Sub Main()

    Load frmMainX
    frmMainX.Show
    Load frmMainY
    frmMainY.Show

    If GetAsyncKeyState(VK_ESCAPE) <> 0 Then
    Unload frmMainX
    Unload frmMainX
    End If


    End Sub

    May someone could tell me what i do wrong?

    Thx,

    Susn

  2. #2
    Guest
    This is wrong:

    If GetAsyncKeyState(VK_ESCAPE) <> 0 Then


    This is right:

    If GetAsyncKeyState(VK_ESCAPE) Then

  3. #3

    Thread Starter
    Member susn's Avatar
    Join Date
    Feb 2001
    Location
    Dubai
    Posts
    48

    ESCAPE

    Thank you Matthew.

  4. #4
    Guest
    Or you can do the following, since it returns True on success.
    Code:
    GetAsyncKeyState(VK_ESCAPE) = 1

  5. #5
    Guest
    Originally posted by Megatron
    Or you can do the following, since it returns True on success.
    Code:
    GetAsyncKeyState(VK_ESCAPE) = 1
    By default, it's already 1-True.

  6. #6
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    . But doesn't she need some kind of loop?
    I didn't see any problem with the way she was using the command, though i would have used " = 1 " myself.
    The problem with her code is she only checked for the escape key one time. When the program was loaded.
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  7. #7

    Thread Starter
    Member susn's Avatar
    Join Date
    Feb 2001
    Location
    Dubai
    Posts
    48

    ESCAPE

    HELLO!

    You are right, Lord Orwell ....
    Further checking the Status of Escape Key in the Timer Event .....

  8. #8
    coder. Lord Orwell's Avatar
    Join Date
    Feb 2001
    Location
    Elberfeld, IN
    Posts
    7,628
    heh, the users of this board see so many incorrect api calls, etc. causing bugs, that sometimes we forget to look for simple logic problems in the design...
    My light show youtube page (it's made the news) www.youtube.com/@lightsofelberfeld
    Contact me on the socials www.facebook.com/lordorwell

  9. #9
    New Member
    Join Date
    Mar 2001
    Posts
    5

    Talking VK_ESCAPE = &H1B

    May she only needed the Syntax of this call ....
    Possible that only was an Example.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width