Sense CTRL pressed

  • Thread starter Thread starter Bill
  • Start date Start date
B

Bill

In the Access Switchboard, the OnCurrent
event gets control whenever a user moves
from one option to another. I want to sense
if the user is holding down the CTRL key
when they click on an item. I tried to
capture with a MouseDown event procedure
but the OnCurrent apparently preempts the
MouseDown event, so it never fires.

Any suggestions?

Thanks,
Bill
 
Bill said:
In the Access Switchboard, the OnCurrent
event gets control whenever a user moves
from one option to another.

Only when they move from one switchboard level to another.
I want to sense
if the user is holding down the CTRL key
when they click on an item. I tried to
capture with a MouseDown event procedure
but the OnCurrent apparently preempts the
MouseDown event, so it never fires.

Any suggestions?

You can tell at any point whether the Ctrl key is pressed, by calling the
Windows GetKeyState API function. With these declarations in, say, a
standard module:


Public Declare Function GetKeyState _
Lib "user32" _
(ByVal nVirtKey As Long) _
As Long

Public Const VK_CONTROL As Integer = &H11 ' Ctrl

.... you could put code into the switchboard's HandleButtonClick function
like this:

If GetKeyState(VK_CONTROL) < 0 Then
' The {Ctrl} key is currently pressed.
Else
' It isn't.
End If
 
Sounds straight forward enough. I can't get to the
actual changes until this evening or tomorrow
morning. If I don't post back by then, you can
assume everything went as suggested.
Thanks,
Bill Stanton
 
Worked great!!!
Thanks Dirk,
Bill Stanton



Bill said:
Sounds straight forward enough. I can't get to the
actual changes until this evening or tomorrow
morning. If I don't post back by then, you can
assume everything went as suggested.
Thanks,
Bill Stanton
 
Back
Top