[AccessD] Windows Key - ASCII Code - OT

MartyConnelly martyconnelly at shaw.ca
Tue Mar 8 13:53:33 CST 2005


Here is how I do it
 The constant is VK_LWIN so it is hex 5B  some keyboards have two 
windows buttons

Private Const VK_LWIN = &H5B   'Left window button
Private Const VK_RETURN = &HD  'ENTER key
Private Const VK_SHIFT = &H10 'SHIFT key
Private Const VK_CONTROL = &H11 'CTRL key
Private Const VK_MENU = &H12 'ALT key
Private Const VK_PAUSE = &H13 'PAUSE key
Private Const VK_CAPITAL = &H14 'CAPS LOCK key
Private Const VK_SNAPSHOT = &H2C  'Print Screen
Private Const VK_APPS = &H5D
         'Applications key on a Microsoft Natural Keyboard
'from http://support.microsoft.com/view/dev.asp?kb=242971

Const GW_HWNDFIRST = 0
Const GW_HWNDNEXT = 2
Private Const KEYEVENTF_KEYUP = &H2

Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, _
    ByVal bScan As Byte, ByVal dwflags As Long, ByVal dwExtraInfo As Long)
Sub OpenWindowsHelp()
' Open the Windows Help  Windows - F1
'
' You can use the same technique to programmatically "press" any other
' key, including Shift, Ctrl, Alt and keys combinations that can't be
' simulated through SendKeys
'vbKey constants partially definined in Access Help
    ' programmatically press the Windows key
    keybd_event VK_LWIN, 0, 0, 0
    ' then press and then release the F1 key
    keybd_event vbKeyF1, 0, 0, 0
    keybd_event vbKeyF1, 0, KEYEVENTF_KEYUP, 0
    ' and finally release the Windows Key
    keybd_event VK_LWIN, 0, KEYEVENTF_KEYUP, 0
End Sub

Sub CloseAllWindows()
' Minimize all open windows Windows-M
'Const acaltMask
    ' programmatically press the Windows key
    keybd_event VK_LWIN, 0, 0, 0
    ' then press and then release the M key
    keybd_event vbKeyM, 0, 0, 0
    keybd_event vbKeyM, 0, KEYEVENTF_KEYUP, 0
    ' and finally release the Windows Key
    keybd_event VK_LWIN, 0, KEYEVENTF_KEYUP, 0
End Sub

Nicholson, Karen wrote:

>Maybe I should say, how do I program in Access, what is the shortcut,
>like [page up], etc.
>
>-----Original Message-----
>From: accessd-bounces at databaseadvisors.com
>[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Nicholson,
>Karen
>Sent: Tuesday, March 08, 2005 2:18 PM
>To: accessd at databaseadvisors.com
>Subject: [AccessD] Windows Key - ASCII Code - OT
>
>
>Anyone know what the ASCII code is to invoke the functionality that is
>provided by the Windows key (the little flying window) on the keyboard?
>  
>

-- 
Marty Connelly
Victoria, B.C.
Canada






More information about the AccessD mailing list