[AccessD] IDIOT! Shift + Click resolved...

DWUTKA at marlow.com DWUTKA at marlow.com
Fri Feb 6 16:13:18 CST 2004


Told you I was groggy.  When I get tired, my first reaction is
usually....'hey, I know there's got to be an API call for that!'.

Just for the fun of it, here is how you can do this with an API call.  I am
posting it, because it can go beyond what you are going to get with the
MouseDown event.  With NT machines, the following code will detect both left
and/or right shift key depression:

Option Compare Database
Option Explicit
Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long)
As Integer
Private Const VK_LSHIFT = &HA0
Private Const VK_RSHIFT = &HA1

Private Sub Command1_Click()
Dim intLeft As Integer
Dim intRight As Integer
intLeft = GetAsyncKeyState(VK_LSHIFT)
intRight = GetAsyncKeyState(VK_RSHIFT)
If intLeft < 0 And intRight < 0 Then 'Both Shifts are Pressed
    MsgBox "You are pressing both left and right shift keys."
Else
    If intLeft < 0 Then 'Just the Left shift is pressed
        MsgBox "You are pressing the Left shift key."
    Else
        If intRight < 0 Then 'Just the Right Shift is pressed
            MsgBox "You are pressing the Right shift key."
        Else 'No Shifts are being pressed
            MsgBox "No shift keys are being pressed."
        End If
    End If
End If
End Sub

Drew

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Christopher
Hawkins
Sent: Friday, February 06, 2004 3:43 PM
To: accessd at databaseadvisors.com
Subject: [AccessD] IDIOT! Shift + Click resolved...


..I was looking at the wrong event.

*slaps forehead*

MouseDown has a built-in check for Shift.  I've been staring at the
Click event for an hour, saying to myself "I know I've done this, but
I can't remember how..."

*sigh*

Sometimes I think just writing the "ask for help" message clarifies
the problem enough that the message itself becoems moot.  Heh.  Sorry
for the traffic.

-C-


_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com


More information about the AccessD mailing list