IIS and SMTP - capture logo keys

This is Interesting: Free IT Magazines  
Home > Archive > IIS and SMTP > April 2005 > capture logo keys





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author capture logo keys
Blake

2005-04-05, 5:52 pm

I have a kiosk app that needs to capture certain keystrokes (alt-tab,
alt-esc, ctrl-esc).

My problem is I can't capture keystrokes that involve the windows logo key
(logo-e, for example, opens explorer).

I can't find the keycode for this key.

Any ideas?


Blake

2005-04-05, 5:52 pm

This code works great for alt-tab, alt-esc, etc. but I am unsure how to get
it to capture the logo+something keystrokes

Any help appreciated

Blake

Option Explicit

Public Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory"
(Destination As Any, Source As Any, ByVal Length As Long)
Public Declare Function GetKeyState Lib "user32" (ByVal nVirtKey As Long) As
Integer
Public Declare Function SetWindowsHookEx Lib "user32" Alias
"SetWindowsHookExA" (ByVal idHook As Long, ByVal lpfn As Long, ByVal hmod As
Long, ByVal dwThreadId As Long) As Long
Public Declare Function CallNextHookEx Lib "user32" (ByVal hHook As Long,
ByVal nCode As Long, ByVal wParam As Long, lParam As Any) As Long
Public Declare Function UnhookWindowsHookEx Lib "user32" (ByVal hHook As
Long) As Long
Public Const HC_ACTION = 0
Public Const WM_KEYDOWN = &H100
Public Const WM_KEYUP = &H101
Public Const WM_SYSKEYDOWN = &H104
Public Const WM_SYSKEYUP = &H105
Public Const VK_TAB = &H9
Public Const VK_CONTROL = &H11
Public Const VK_ESCAPE = &H1B

Public Const WH_KEYBOARD_LL = 13
Public Const LLKHF_ALTDOWN = &H20

Public Type KBDLLHOOKSTRUCT
vkCode As Long
scanCode As Long
flags As Long
time As Long
dwExtraInfo As Long
End Type

Dim p As KBDLLHOOKSTRUCT

Public Function LowLevelKeyboardProc(ByVal nCode As Long, ByVal wParam As
Long, ByVal lParam As Long) As Long
Dim fEatKeystroke As Boolean

If (nCode = HC_ACTION) Then
If wParam = WM_KEYDOWN Or wParam = WM_SYSKEYDOWN Or wParam = WM_KEYUP
Or wParam = WM_SYSKEYUP Then
CopyMemory p, ByVal lParam, Len(p)
fEatKeystroke = _
((p.vkCode = VK_TAB) And ((p.flags And LLKHF_ALTDOWN) <> 0)) Or
_
((p.vkCode = VK_ESCAPE) And ((p.flags And LLKHF_ALTDOWN) <> 0))
Or _
((p.vkCode = VK_ESCAPE) And ((GetKeyState(VK_CONTROL) And
&H8000) <> 0))
End If
End If

If fEatKeystroke Then
LowLevelKeyboardProc = -1
Else
LowLevelKeyboardProc = CallNextHookEx(0, nCode, wParam, ByVal
lParam)
End If
End Function

"Blake" <blake_duffey@NOSPAM.hotmail.com> wrote in message
news:eVK9LfgOFHA.3296@TK2MSFTNGP15.phx.gbl...
>I have a kiosk app that needs to capture certain keystrokes (alt-tab,
>alt-esc, ctrl-esc).
>
> My problem is I can't capture keystrokes that involve the windows logo key
> (logo-e, for example, opens explorer).
>
> I can't find the keycode for this key.
>
> Any ideas?
>



Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com