|
-
Feb 27th, 2001, 04:42 PM
#1
Thread Starter
Member
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
-
Feb 27th, 2001, 08:12 PM
#2
This is wrong:
If GetAsyncKeyState(VK_ESCAPE) <> 0 Then
This is right:
If GetAsyncKeyState(VK_ESCAPE) Then
-
Feb 28th, 2001, 11:58 AM
#3
Thread Starter
Member
-
Feb 28th, 2001, 12:21 PM
#4
Or you can do the following, since it returns True on success.
Code:
GetAsyncKeyState(VK_ESCAPE) = 1
-
Feb 28th, 2001, 02:22 PM
#5
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.
-
Mar 1st, 2001, 05:37 AM
#6
. 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.
-
Mar 1st, 2001, 01:43 PM
#7
Thread Starter
Member
ESCAPE
HELLO!
You are right, Lord Orwell ....
Further checking the Status of Escape Key in the Timer Event .....
-
Mar 1st, 2001, 02:17 PM
#8
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...
-
Mar 2nd, 2001, 05:59 AM
#9
New Member
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|