UtterAccess HomeUtterAccess Wiki

Welcome Guest ( Log In | Register )

Custom Search
Edit Discussion
> GetKeyMasks    

The KeyMasks can be obtained by performing a check against the applicable key masks. Often the key masks are hard to remember. Pass your boolean variables ByRef to this function and get a return for each Shift, Ctrl or Alt key status/

CODE

' Code courtesy of UtterAccess Wiki
' http://www.utteraccess.com/wiki/index.php/Category:FunctionLibrary
'
' You are free to use this code in any application,
' provided this notice is left unchanged.
'
' REV  DATE                          DESCRIPTION
' 1.0  2010-08-06              initial release
' 1.1  2010-09-12              changed header
'==============================================================================
' NAME: GetKeyMasks
' PURPOSE: returns boolean to deterimine if the Shift Ctrl or Alt key is down
' RETURNS: None (byref args)
'==============================================================================
'ErrHandler V3.01
Public Function GetKeyMasks( _
   ByVal iShift As Integer, _
   Optional ByRef bShift As Boolean = False, _
   Optional ByRef bCtrl As Boolean = False, _
   Optional ByRef bAlt As Boolean = False)
On Error GoTo Error_Proc
'=========================

'=========================

 bShift = (iShift And acShiftMask) <> 0
 bCtrl = (iShift And acCtrlMask) <> 0
 bAlt = (iShift And acAltMask) <> 0
 
'=========================
Exit_Proc:
 Exit Function
Error_Proc:
 Select Case Err.Number
   Case Else
     MsgBox "Error: " & Trim(Str(Err.Number)) & vbCrLf & _
       "Desc: " & Err.Description & vbCrLf & vbCrLf & _
       "Procedure: GetKeyMasks" _
       , vbCritical, "Error!"
 End Select
 Resume Exit_Proc
 Resume
End Function


Creative Commons License
GetKeyMasks by UtterAccess Wiki is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Editing and revision of the content is freely encouraged; for details, see Expected Usage.

Edit Discussion
Custom Search
Thank you for your support!
This page has been accessed 3,790 times.  This page was last modified 08:34, 6 April 2011 by Jack Leach.   Disclaimers