Click to See Complete Forum and Search --> : Vk_escape = &h1b
susn
Feb 27th, 2001, 03:42 PM
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
This is wrong:
If GetAsyncKeyState(VK_ESCAPE) <> 0 Then
This is right:
If GetAsyncKeyState(VK_ESCAPE) Then
susn
Feb 28th, 2001, 10:58 AM
Thank you Matthew.
Or you can do the following, since it returns True on success.
GetAsyncKeyState(VK_ESCAPE) = 1
Originally posted by Megatron
Or you can do the following, since it returns True on success.
GetAsyncKeyState(VK_ESCAPE) = 1
By default, it's already 1-True.
Lord Orwell
Mar 1st, 2001, 04:37 AM
. 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.
susn
Mar 1st, 2001, 12:43 PM
HELLO!
You are right, Lord Orwell ....
Further checking the Status of Escape Key in the Timer Event .....
Lord Orwell
Mar 1st, 2001, 01:17 PM
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... :p
RedZack
Mar 2nd, 2001, 04:59 AM
May she only needed the Syntax of this call ....
Possible that only was an Example.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.