@msdn=http://search.microsoft.com/search/results.aspx?qu=$$$ @pinvoke=http://pinvoke.net/$$$.htm Summary: The KBDLLHOOKSTRUCT structure contains information about a low-level keyboard input event !!!!C# Definition: [StructLayout(LayoutKind.Sequential)] public class KBDLLHOOKSTRUCT { public uint vkCode; public uint scanCode; public KBDLLHOOKSTRUCTFlags flags; public uint time; public UIntPtr dwExtraInfo; } [Flags] public enum KBDLLHOOKSTRUCTFlags : uint { LLKHF_EXTENDED = 0x01, LLKHF_INJECTED = 0x10, LLKHF_ALTDOWN = 0x20, LLKHF_UP = 0x80, } private static IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam) { if (nCode >= 0 && wParam == (IntPtr)WM_KEYDOWN) { KBDLLHOOKSTRUCT kbd = (KBDLLHOOKSTRUCT) Marshal.PtrToStructure(lParam, typeof(KBDLLHOOKSTRUCT)); Debug.WriteLine(kbd.vkCode); // ***** your code here ***** } return CallNextHookEx(_hookID, nCode, wParam, lParam); } !!!!Visual Basic 9 declaration <StructLayout(LayoutKind.Sequential)> _ Public Structure KBDLLHOOKSTRUCT Public vkCode As UInt32 Public scanCode As UInt32 Public flags As KBDLLHOOKSTRUCTFlags Public time As UInt32 Public dwExtraInfo As UIntPtr End Structure <Flags()> _ Public Enum KBDLLHOOKSTRUCTFlags As UInt32 LLKHF_EXTENDED = &H1 LLKHF_INJECTED = &H10 LLKHF_ALTDOWN = &H20 LLKHF_UP = &H80 End Enum !!!!VB Definition: <StructLayout(LayoutKind.Sequential)> _ Public Class KBDLLHOOKSTRUCT public vkCode As UInt32 public scanCode As UInt32 public flags As UInt32 public time As UInt32 public dwExtraInfo As UIntPtr End Class !!!!Notes: This is named "struct" to be consistent with the Windows API name, but it is defined as a class since it is passed as a pointer (AKA reference) in SetWindowsHookEx and CallNextHookEx. Or it can be defined as a struct and passed with ref (ByRef in VB.NET). Documentation: KBDLLHOOKSTRUCT@msdn on MSDN http://msdn.microsoft.com/en-us/library/windows/desktop/ms644967(v=vs.85).aspx
Edit Structures.KBDLLH...
You do not have permission to change this page. If you feel this is in error, please send feedback with the contact link on the main page.