Private Shared Function KeyBoardHookProc(ByVal nCode As Integer, ByVal wParam As Integer, ByVal lParam As IntPtr) As Integer
'All keyboard events will be sent here.
'Don't process just pass along.
If nCode < 0 Then
Return CallNextHookEx(HookId, nCode, wParam, lParam)
End If
'Extract the keyboard structure from the lparam
'This will contain the virtual <strong class="highlight">key</strong> and any flags.
'This is using the my.computer.keyboard to get the
'flags instead
Dim KeyboardSruct As KBDLLHOOKSTRUCT = Marshal.PtrToStructure(lParam, GetType(KBDLLHOOKSTRUCT))
If KeyboardSruct.vkCode = Vk_Tab And My.Computer.Keyboard.AltKeyDown Then
'Alt Tab
Return 1
ElseIf KeyboardSruct.vkCode = Vk_Escape And My.Computer.Keyboard.CtrlKeyDown Then
'Control Escape
Return 1
End If
'Send the message along
Return CallNextHookEx(HookId, nCode, wParam, lParam)
End Function