Desktop Functions: Smart Device Functions:
|
Search Results for "keyboard" in [All]Interfaces1: IDeskBand
''' Called by explorer to process keyboard events. Undersatands Tab and F6. 2: IDeskBand2
''' Called by explorer to process keyboard events. Undersatands Tab and F6. user32
/// <summary>Sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process. The input locale identifier specifies a locale as well as the physical layout of the keyboard</summary>
internal static extern HKL ActivateKeyboardLayout(HKL hkl, uint Flags);
''' <summary>Sets the input locale identifier (formerly called the keyboard layout handle) for the calling thread or the current process. The input locale identifier specifies a locale as well as the physical layout of the keyboard</summary>
Public Shared Function ActivateKeyboardLayout(ByVal nkl As IntPtr, ByVal Flags As uint) As Integer 4: BlockInput
''' <summary>The BlockInput function blocks keyboard and mouse input events from reaching applications
''' <param name="fBlockIt">[in] Specifies the function's purpose. If this parameter is non-zero, keyboard
''' and mouse input events are blocked. If this parameter is zero, keyboard and mouse events are unblocked. Blocks or unblocks mouse and keyboard input.
// overload for use with LowLevelKeyboardProc
' overload for use with LowLevelKeyboardProc
' overload for use with LowLevelKeyboardProc
/// <para>The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).</para>
''' <para>The DestroyWindow function destroys the specified window. The function sends WM_DESTROY and WM_NCDESTROY messages to the window to deactivate it and remove the keyboard focus from it. The function also destroys the window's menu, flushes the thread message queue, destroys timers, removes clipboard ownership, and breaks the clipboard viewer chain (if the window is at the top of the viewer chain).</para> This works not for keyboard only, for mouse also (VK_RBUTTON, VK_LBUTTON). The ManagedWindowsApi project (http://mwinapi.sourceforge.net) provides a KeyboardKey class to detect keyboard state and synthesize keyboard events. This function can greatly boost the performance of any application. When calling Application.DoEvents() to make the UI responsive, it generally decreases application performance. With this function, we make sure there is at least one event (keyboard or mouse) that needs to be processed before calling Application.DoEvents(). (VB2TheMax.com : Francesco Balena)
static extern bool GetKeyboardLayoutName([Out] StringBuilder pwszKLID);
public static extern bool GetKeyboardLayoutName(IntPtr pwszKLID);
public static extern bool GetKeyboardLayoutName(IntPtr pwszKLID);
string keyboardLanguage;
length = GetKeyboardLayoutName(locale);
keyboardLanguage = locale.ToString().Substring(0, length); Mapping of all keyboard layout IDs on Windows 7 to their respective names
public class KeyboardLayout
private static extern long GetKeyboardLayoutName(StringBuilder pwszKLID);
GetKeyboardLayoutName(name);
return "Chinese (traditional) - us keyboard";
return "Chinese (simplified) -us keyboard";
return "Chinese (traditional, hong kong s.a.r.) - us keyboard";
return "Chinese (simplified, singapore) - us keyboard";
return "Chinese (traditional, macao s.a.r.) - us keyboard";
static extern uint GetKeyboardLayoutList(int nBuff, [Out] IntPtr [] lpList);
uint nElements = GetKeyboardLayoutList(0, null);
GetKeyboardLayoutList(ids.Length, ids);
static extern bool GetKeyboardLayoutName([Out] StringBuilder pwszKLID);
public static extern bool GetKeyboardLayoutName(IntPtr pwszKLID);
public static extern bool GetKeyboardLayoutName(IntPtr pwszKLID);
string keyboardLanguage;
length = GetKeyboardLayoutName(locale);
keyboardLanguage = locale.ToString().Substring(0, length); 12: GetKeyboardState
static extern bool GetKeyboardState(byte [] lpKeyState);
Private Shared Function GetKeyboardState(ByVal keyState() As Byte) As Boolean
Private Declare Function GetKeyboardState Lib "user32" (ByVal keyState() As Byte) As Boolean In some cases this function will always return the same array, independent of actual keyboard state. This is due to Windows not updating the virtual key array internally. It has been found that declaring and calling GetKeyState on any key before calling GetKeyboardState will solve this issue.
public static class Keyboard {
if(!NativeMethods.GetKeyboardState(keys)){
internal static extern bool GetKeyboardState(byte[] lpKeyState);
Private Shared Function GetKeyboardState(ByVal keyState() As Byte) As Boolean
Dim result As Boolean = GetKeyboardState(keyState)
Debug.WriteLine("GetKeyBoardState error: " & Marshal.GetLastWin32Error)
Throw New Exception("GetKeyBoardState error: " & Marshal.GetLastWin32Error)
' Example - the keyboard lights...
public class Keyboard 13: GetKeyboardType 14: GetKeyNameText The ManagedWindowsApi project (http://mwinapi.sourceforge.net) provides a KeyboardKey class to detect keyboard state and synthesize keyboard events. It can also give you names of keys. 15: GetLastInputInfo Moving the mouse or pressing the keyboard during the test will alter the result, as expected! 16: GetRawInputData
public DeviceInfoKeyboard KeyboardInfo;
public struct DeviceInfoKeyboard
public uint KeyboardMode;
internal struct RID_DEVICE_INFO_KEYBOARD
public int dwKeyboardMode;
public RID_DEVICE_INFO_KEYBOARD keyboard;
KEYBOARD = 1, 20: KeyboardKey
21: KeyboardProc
static extern TODO KeyboardProc(TODO);
Declare Function KeyboardProc Lib "user32.dll" (TODO) As TODO
static extern IntPtr LoadKeyboardLayout(string pwszKLID, uint Flags); LoadKeyboardLayout("00000429", 1); // This is not alternative, this will set the default input language based on installed keyboard layouts, if //the layout is not installed in regional settings, nothing will happen, but with LoadKeyboardLayout, the input
static extern TODO LowLevelKeyboardProc(TODO);
Declare Function LowLevelKeyboardProc Lib "user32.dll" (TODO) As TODO 24: SendInput
type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,
type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,
type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,
type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,
type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,
type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_S } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_S ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::MENU } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_E } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::MENU ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_E ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::CONTROL } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_F } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::CONTROL ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
$_inputList.Add( $( New-Object Testing.Windows3+INPUT -Property @{ type = [Testing.Windows3+INPUT_TYPE]::KEYBOARD ; U = $( New-Object Testing.Windows3+InputUnion -Property @{ ki = $( New-Object Testing.Windows3+KEYBDINPUT -Property @{ wVk = [Testing.Windows3+VirtualKeyShort]::KEY_F ; dwFlags = $( [Testing.Windows3+KEYEVENTF]::KEYUP ) } ) } ) } ) )
/// Brings the thread that created the specified window into the foreground and activates the window. Keyboard input is 26: SetKeyboardState
static extern bool SetKeyboardState(byte [] lpKeyState);
Private Shared Function SetKeyboardState(ByVal lpKeyState() As Byte) As Boolean
Private Declare Function GetKeyboardState Lib "user32" (ByRef pbKeyState As Byte) As Integer
Private Declare Function SetKeyboardState Lib "user32" (ByRef lppbKeyState As Byte) As Integer
GetKeyboardState(keys(0))
SetKeyboardState(keys(0))
SetKeyboardState(keys(0))
GetKeyboardState(keys(0))
SetKeyboardState(keys(0))
SetKeyboardState(keys(0)) .NET 2.0: My.Computer.Keyboard.SendKeys 27: SetWindowsHookEx
/// <term>WH_KEYBOARD (2)</term>
/// KeyboardProc hook procedure.
/// <term>WH_KEYBOARD_LL (13)</term>
/// Installs a hook procedure that monitors low-level keyboard input events. For more information,
/// see the LowLevelKeyboardProc hook procedure.
/// <term>WH_KEYBOARD (2)</term>
/// <term>WH_KEYBOARD_LL (13)</term>
/// WH_KEYBOARD, WH_JOURNAL*, WH_SHELL, and low-level hooks can be called on the thread that installed the hook
/// <term>WH_KEYBOARD </term>
/// <term>WH_KEYBOARD_LL </term>
hHook = SetWindowsHookEx(HookType.WH_KEYBOARD_LL, hook, hModule, 0);
// this sample installs a keyboard hook
// setup a keyboard hook
SetWindowsHookEx(HookType.WH_KEYBOARD, this.myCallbackDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId());
' My sample installs a keyboard hook
' setup a keyboard hook
SetWindowsHookEx(HookType.WH_KEYBOARD, Me.myCallbackDelegate, IntPtr.Zero, AppDomain.GetCurrentThreadId()) MSDN article on KeyboardProc: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/keyboardproc.asp Stephen Toub entry on low-level keyboard hook in C#: http://blogs.msdn.com/toub/archive/2006/05/03/589423.aspx 28: ToUnicode Convert a ASCI Character into Unicode Character with the Keyboard Layout
static extern bool GetKeyboardState(byte [] lpKeyState);
static extern IntPtr GetKeyboardLayout(uint idThread);
bool bKeyStateStatus = GetKeyboardState(bKeyState);
IntPtr HKL = GetKeyboardLayout(0); 29: ToUnicodeEx Convert a ASCI Character into Unicode Character with the Keyboard Layout
static extern bool GetKeyboardState(byte [] lpKeyState);
static extern IntPtr GetKeyboardLayout(uint idThread);
bool bKeyStateStatus = GetKeyboardState(bKeyState);
IntPtr HKL = GetKeyboardLayout(0); 31: VirtualKeyCodes 32: VkKeyScan
static extern bool UnloadKeyboardLayout(IntPtr hkl);
static extern IntPtr LoadKeyboardLayout(string pwszKLID, uint Flags);
public class KeyboardPointer : IDisposable
public KeyboardPointer(int klid)
pointer = LoadKeyboardLayout(klid.ToString("X8"), 1);
public KeyboardPointer(CultureInfo culture)
:this(culture.KeyboardLayoutId){}
UnloadKeyboardLayout(pointer);
~KeyboardPointer()
UnloadKeyboardLayout(pointer);
using(var keyboard = new KeyboardPointer(culture))
if(keyboard.GetKey(test, out key)) 33: VkKeyScanEx
static extern bool UnloadKeyboardLayout(IntPtr hkl);
static extern IntPtr LoadKeyboardLayout(string pwszKLID, uint Flags);
public class KeyboardPointer : IDisposable
public KeyboardPointer(int klid)
pointer = LoadKeyboardLayout(klid.ToString("X8"), 1);
public KeyboardPointer(CultureInfo culture)
:this(culture.KeyboardLayoutId){}
UnloadKeyboardLayout(pointer);
~KeyboardPointer()
UnloadKeyboardLayout(pointer);
using(var keyboard = new KeyboardPointer(culture))
if(keyboard.GetKey(test, out key)) msvcrt34: kbhit
35: _spawn
// or keyboard. Calls to _cwait against the new process will wtsapi32
/// The physical console is the monitor, keyboard, and mouse. Structures37: INPUT
INPUT_KEYBOARD = 1, 38: INPUT_TYPE
INPUT_KEYBOARD = 1, 39: KBDLLHOOKSTRUCT
40: KEYBDINPUT
///Left Windows key (Microsoft Natural keyboard)
///Right Windows key (Natural keyboard)
///Applications key (Natural keyboard)
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Used for miscellaneous characters; it can vary by keyboard.
///Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard
///The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, 41: KEY_EVENT_RECORD
42: RAWINPUTDEVICE
/// <summary>Handle to the target device. If NULL, it follows the keyboard focus.</summary>
''' <summary>Handle to the target device. If NULL, it follows the keyboard focus.</summary> 43: RAWINPUTKEYBOARD
/// Value type for raw input from a keyboard.
public struct RAWKEYBOARD
public RawKeyboardFlags Flags;
''' Value type for raw input from a keyboard.
Public Structure RAWKEYBOARD
Public Flags As RawKeyboardFlags 44: Win32Consts
public const int INPUT_KEYBOARD = 1;
INPUT_KEYBOARD = 1 coredll45: keybd_event
46: SendInput
static extern uint SendInput(uint cInputs, /* [MarshalAs(UnmanagedType.LPArray)] */ KEYBOARDINPUT[] inputs, int cbSize);
public struct KEYBOARDINPUT
public const uint INPUT_KEYBOARD = 1;
public static extern uint SendInput(uint cInputs, /* [MarshalAs(UnmanagedType.LPArray)] */ KEYBOARDINPUT[] inputs, int cbSize);
KEYBOARDINPUT[] inputs;
inputs = new cTabControl.KEYBOARDINPUT[2];
inputs[0].type = inputs[1].type = cTabControl.INPUT_KEYBOARD;
KEYBOARDINPUT[] inputs;
inputs = new cTabControl.KEYBOARDINPUT[4];
inputs[0].type = inputs[1].type = inputs[2].type = inputs[3].type = cTabControl.INPUT_KEYBOARD;
KEYBOARDINPUT[] inputs;
inputs = new cTabControl.KEYBOARDINPUT[4];
inputs[0].type = inputs[1].type = inputs[2].type = inputs[3].type = cTabControl.INPUT_KEYBOARD;
KEYBOARDINPUT[] inputs;
inputs = new cTabControl.KEYBOARDINPUT[6];
inputs[0].type = inputs[1].type = inputs[2].type = inputs[3].type = inputs[4].type = inputs[5].type = cTabControl.INPUT_KEYBOARD; 47: SipSetCurrentIM
public static readonly Guid ClsidKeyboard = new Guid("42429667-ae04-11d0-a4f8-00aa00a749b9"); imm32
IntPtr hKL = GetKeyboardLayout(0); Constants49: GUID_DEVCLASS
public static readonly Guid GUID_DEVCLASS_KEYBOARD = new Guid("{0x4d36e96b, 0xe325, 0x11ce, {0xbf, 0xc1, 0x08, 0x00, 0x2b, 0xe1, 0x03, 0x18}}");
public static Guid GUID_DEVINTERFACE_KEYBOARD = new Guid("884b96c3-56ef-11d1-bc8c-00a0c91405dd"); 51: WA_
'''the SetActiveWindow function or by use of the keyboard interface to select the window).
'''the SetActiveWindow function or by use of the keyboard interface to select the window). 52: WINERROR
/// Invalid keyboard layout handle.
public const int ERROR_INVALID_KEYBOARD_HANDLE = 1457; 53: WM
Enums54: DEVICE_TYPE
FILE_DEVICE_KEYBOARD = 0x0b,
FILE_DEVICE_KEYBOARD = &Hb 55: DLGC
/// <summary> Control processes all keyboard input. </summary> 56: HIDUsage
/// <summary>Keyboard controls.</summary>
Keyboard = 0x07,
''' <summary>Keyboard controls.</summary>
Keyboard = &H7 57: HIDUsagePage
/// <summary>Keyboard controls.</summary>
Keyboard = 0x07,
''' <summary>Keyboard controls.</summary>
Keyboard = &H7 59: HookType
WH_KEYBOARD = 2,
WH_KEYBOARD_LL = 13,
WH_KEYBOARD = 2
WH_KEYBOARD_LL = 13 60: KLF
Cut off search results after 60. Please refine your search. |