Search
Module:
Directory

   Desktop Functions:

   Smart Device Functions:


Show Recent Changes
Subscribe (RSS)
Misc. Pages
Comments
FAQ
Helpful Tools
Playground
Suggested Reading
Website TODO List
Download Visual Studio Add-In

Search Results for "INPUT" in [All]

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>

.

/// <param name="hkl">Input locale identifier to be activated.</param>

.

/// <param name="Flags">Specifies how the input locale identifier is to be activated.</param>

.

/// <returns>The return value is of type HKL. If the function succeeds, the return value is the previous input locale identifier. Otherwise, it is zero</returns>

.

''' <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>

.

''' <param name="hkl">Input locale identifier to be activated.</param>

.

''' <param name="Flags">Specifies how the input locale identifier is to be activated.</param>

.

''' <returns>The return value is of type HKL. If the function succeeds, the return value is the previous input locale identifier.

.

[System.Windows.Forms.InputLanguage]

.

- The process received the last input event.

.
Summary
.

static extern bool AttachThreadInput(uint idAttach, uint idAttachTo,

.

Public Shared Function AttachThreadInput(ByVal idAttach As System.UInt32, ByVal idAttachTo As System.UInt32, ByVal fAttach As Boolean) As Boolean

.
Documentation
[AttachThreadInput] on MSDN
.
Summary
.

static extern bool BlockInput(bool fBlockIt);

.

Declare Function BlockInput Lib "user32" (ByVal fBlockIt As Boolean) As Boolean

.

    ''' <summary>The BlockInput function blocks keyboard and mouse input events from reaching applications

.

    ''' and mouse input events are blocked. If this parameter is zero, keyboard and mouse events are unblocked.

.

    ''' If input is already blocked, the return value is zero.

.

    ''' <remarks>Note that only the thread that blocked input can successfully unblock input</remarks>

.

    <DllImport("user32.dll", EntryPoint:="BlockInput", SetLastError:=True, CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)>

.

    Friend Shared Function BlockInput(fBlockIt As Boolean) As Integer

.

Note that this definition does not use Boolean input and return types

.

Blocks or unblocks mouse and keyboard input.

.

Useful to create a temporary block in input for sensitive GUI operations. For instance when manually activating a screen saver from within a GUI function, a short blocking delay will prevent the user mouse movements directly after selection from accidently escaping the screen saver.

.

Class BlockInput

.

    <DllImport("user32.dll", EntryPoint:="BlockInput", SetLastError:=True, CharSet:=CharSet.Auto, CallingConvention:=CallingConvention.StdCall)>

.

    Friend Shared Function BlockInput(fBlockIt As Boolean) As Boolean

.

   Friend Shared Function DisableInput(makeDisabled As Boolean) as Boolean

.

      Return BlockInput(makeDisabled)

.

The ManagedWindowsApi project (http://mwinapi.sourceforge.net) provides an InputBlocker class that can block input.

.
Documentation
[BlockInput] on MSDN
.

        void EnableInput(Control control, bool enabled)

.

Windows Input Simulator

.

An open source managed .NET wrapper written in C# is available on Codeplex at http://inputsimulator.codeplex.com/. It has all of these definitions complete with documented code comments and can be used to determine key states as well. Thanks to all the contributors at pinvoke.

.
Summary
.

static extern bool GetInputState();

.

       if ( !GetInputState() )

.
Documentation
[GetInputState] on MSDN
.

    using System.Windows.Input;

.

Windows Input Simulator

.

An open source managed .NET wrapper written in C# is available on Codeplex at http://inputsimulator.codeplex.com/. It has all of these definitions complete with documented code comments and can be used to determine key states as well. Thanks to all the contributors at pinvoke.

.
Summary
Gets the time of the last user input (in ms since the system started)
.

static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);

.

Shared Function GetLastInputInfo(ByRef plii As LASTINPUTINFO) As Boolean

.

static bool GetLastInputInfo(LASTINPUTINFO* plii);

.

   type LastInputInfo = {

.

   extern int GetLastInputInfo(LastInputInfo& lpi);

.

LASTINPUTINFO

.

Compare to Environment.TickCount to get the time since the last user input.

.

This function retrieves the time in seconds since last user input

.

    static uint GetLastInputTime()

.

        LASTINPUTINFO lastInputInfo = new LASTINPUTINFO();

.

        lastInputInfo.cbSize = (uint)Marshal.SizeOf( lastInputInfo );

.

        lastInputInfo.dwTime = 0;

.

        if ( GetLastInputInfo( ref lastInputInfo ) )

.

        uint lastInputTick = lastInputInfo.dwTime;

.

        idleTime = envTicks - lastInputTick;

.

This function retrieves the time in seconds since last user input

.

Dim lastInputInf As New LASTINPUTINFO()

.

   Public Function GetLastInputTime() As Integer

.

    lastInputInf.cbSize = Marshal.SizeOf(lastInputInf)

.

    lastInputInf.dwTime = 0

.

    If GetLastInputInfo(lastInputInf) Then

.

        idletime = Environment.TickCount - lastInputInf.dwTime

.

This function retrieves the time in seconds since last user input

.

    LASTINPUTINFO lastInputInfo;

.

    lastInputInfo.cbSize = (UInt32)Marshal::SizeOf(lastInputInfo);

.

    lastInputInfo.dwTime = 0;

.

    if (GetLastInputInfo(&lastInputInfo))

.

        int lastInputTicks = (int)lastInputInfo.dwTime;

.

        idleTicks = systemUptime - lastInputTicks;

.

     let size = Marshal.SizeOf (typeof<LastInputInfo>)

.

     match GetLastInputInfo(&info) with

.

Prints time in seconds since last user input.

.

    LASTINPUTINFO lastInputInfo;

.

    lastInputInfo.cbSize = sizeof (lastInputInfo);

.

    lastInputInfo.dwTime = 0;

.

    if (GetLastInputInfo(&lastInputInfo)) {        

.

        int lastInputTicks = (int)lastInputInfo.dwTime;

.

        idleTicks = systemUptime - lastInputTicks;

.
Documentation
[GetLastInputInfo] on MSDN
.

        QS_RAWINPUT =       0x0400,

.

        QS_INPUT = (QS_MOUSE | QS_KEY | QS_RAWINPUT),

.

        QS_ALLEVENTS = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY),

.

        QS_ALLINPUT = (QS_INPUT | QS_POSTMESSAGE | QS_TIMER | QS_PAINT | QS_HOTKEY | QS_SENDMESSAGE)

.
Summary
Function to read raw data from an input device such as a keyboard, mouse or other HID.
.

    /// Function to retrieve raw input data.

.

    /// <param name="hRawInput">Handle to the raw input.</param>

.

    /// <param name="pData">Raw input data.</param>

.

    public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, out RAWINPUT pData, ref int pcbSize, int cbSizeHeader);

.

    /// Function to retrieve raw input data.

.

    /// <param name="hRawInput">Handle to the raw input.</param>

.

    /// <param name="pData">Raw input data.</param>

.

    public static extern int GetRawInputData(IntPtr hRawInput, RawInputCommand uiCommand, byte[] pData, ref int pcbSize, int cbSizeHeader);

.

Declare Function GetRawInputData Lib "user32.dll" (TODO) As TODO

.

RAWINPUT is incompatible with x64. See RAWINPUTHEADER.Device and RAWINPUTHEADER.wParam.

.

        if (m.Msg == (int)WindowMessages.RawInput)  // WindowMessages.RawInput = 0x00FF (WM_INPUT)

.

            RAWINPUT input = new RAWINPUT();

.

            int size = Marshal.SizeOf(typeof(RAWINPUT));

.

            outSize = Win32API.GetRawInputData(m.LParam, RawInputCommand.Input, out input, ref size, Marshal.SizeOf(typeof(RAWINPUTHEADER)));

.

                if (input.Header.Type == RawInputType.Mouse)

.

                    p.X += input.Mouse.LastX;

.

                    p.Y += input.Mouse.LastY;

.

                    label1.Text = "Mouse: " + p.X.ToString() + "x" + p.Y.ToString() + " " + input.Mouse.ButtonFlags.ToString();

.
Documentation
[GetRawInputData] on MSDN
.

    public static extern uint GetRawInputDeviceInfo(int deviceHandle, uint command, ref DeviceInfo data, ref uint dataSize);

.

Declare Function GetRawInputDeviceInfo  Lib "user32.dll" (TODO) As TODO

.

    User32.GetRawInputDeviceInfo(device.hDevice, User32.RIDI_DEVICEINFO, ref di, ref size);

.
Documentation
.
Summary
The GetRawInputDeviceInfo function gets information about the raw input device.
.

static extern uint GetRawInputDeviceInfo(IntPtr hDevice, uint uiCommand, IntPtr pData, ref uint pcbSize);

.

Declare Function GetRawInputDeviceInfo Lib "user32.dll" Alias "GetRawInputDeviceInfoW" (ByVal hDevice As IntPtr, ByVal uiCommand As DeviceInfoTypes, ByVal pData As IntPtr, ByRef pcbSize As UInteger) As Integer

.
Documentation
[GetRawInputDeviceInfo] on MSDN
.
Summary
The GetRawInputDeviceList function enumerates the raw input devices attached to the system.
.

    public enum RawInputDeviceType : uint

.

    public struct RAWINPUTDEVICELIST

.

        public RawInputDeviceType Type;

.

    public static extern uint GetRawInputDeviceList

.

        [In, Out] RAWINPUTDEVICELIST[] RawInputDeviceList,

.

        uint Size /* = (uint)Marshal.SizeOf(typeof(RawInputDeviceList)) */

.

    Public Structure RAWINPUTDEVICELIST

.

    EntryPOint:="GetRawInputDeviceList", SetLastError:=True)> _

.

    Public Function GetRawInputDeviceList(ByVal pRawInputDeviceList As

.

Declare Function GetRawInputDeviceList Lib "user32.dll" (ByVal pRawInputDeviceList As

.

int structSize = Marshal.SizeOf(typeof(RAWINPUTDEVICELIST));    

.

int deviceCount = GetRawInputDeviceList(buffer, ref bufferCount, structSize);

.

    RAWINPUTDEVICELIST device = (RAWINPUTDEVICELIST)Marshal.PtrToStructure(

.

new IntPtr((buffer.ToInt32() + (structSize * i))),typeof(RAWINPUTDEVICELIST));

.

    // A convenient function for getting all raw input devices.

.

    public static RAWINPUTDEVICELIST[] GetAllRawDevices()

.

        uint dwSize = (uint)Marshal.SizeOf(typeof(RAWINPUTDEVICELIST));

.

        uint retValue = Win32API.GetRawInputDeviceList(null, ref deviceCount, dwSize);

.

        RAWINPUTDEVICELIST[] deviceList = new RAWINPUTDEVICELIST[deviceCount];

.

        retValue = Win32API.GetRawInputDeviceList(deviceList, ref deviceCount, dwSize);

.

       //IntPtr pRawInputDeviceList = Marshal.AllocHGlobal((int)(dwSize * deviceCount));

.

       //Marshal.FreeHGlobal(pRawInputDeviceList);

.
Documentation
[GetRawInputDeviceList] on MSDN
.

This function is useful to simulate Key presses (for input use the virtual keycodes from http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/UserInput/VirtualKeyCodes.asp or windows CE universal core virtual key code compact chart http://msdn2.microsoft.com/en-us/library/ms927178.aspx ).

.

Use FindWindow and SetForegroundWindow to direct input to the desired window.

.
Note
WaitForInputIdle (Warning this will only wait once! See Raymond Chen's Blog Post http://blogs.msdn.com/b/oldnewthing/archive/2010/03/25/9984720.aspx ), or a Sleep may be required to assure Window is ready for input:
.

// 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

.

InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new System.Globalization.CultureInfo("fa-IR"));

.

InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new System.Globalization.CultureInfo("En-US"));

.

FYI, Microsoft tells us for "Windows NT/2000/XP: This function has been superseded. Use SendInput instead."

.

Thus I have resigned myself to unmanaged code for now. I will post the SendInput version shortly as mouse_event has been deprecated by Bill in favor of SendInput.

.
Summary
.

static extern IntPtr OpenInputDesktop(uint dwFlags, bool fInherit,

.

     Private Shared Function OpenInputDesktop(ByVal dwFlags As UInteger, ByVal fInherit As Boolean, ByVal dwDesiredAccess As UInteger) As IntPtr

.
Documentation
[OpenInputDesktop] on MSDN
.
Summary
Registers a device to send its raw input data.
.

/// <summary>Function to register a raw input device.</summary>

.

/// <param name="pRawInputDevices">Array of raw input devices.</param>

.

/// <param name="cbSize">Size of the RAWINPUTDEVICE structure.</param>

.

public static extern bool RegisterRawInputDevices([MarshalAs(UnmanagedType.LPArray, SizeParamIndex=0)] RAWINPUTDEVICE[] pRawInputDevices, int uiNumDevices, int cbSize);

.

''' <summary>Function to register a raw input device.</summary>

.

''' <param name="pRawInputDevices">Array of raw input devices.</param>

.

''' <param name="cbSize">Size of the RAWINPUTDEVICE structure.</param>

.

Public Shared Function RegisterRawInputDevices(<MarshalAs(UnmanagedType.LPArray, SizeParamIndex := 0)> ByVal pRawInputDevices As RAWINPUTDEVICE(), ByVal uiNumDevices As Integer, ByVal cbSize As Integer) As Boolean

.

RAWINPUTDEVICE

.

        RAWINPUTDEVICE device;

.

        device.Flags = RawInputDeviceFlags.InputSink;

.

        Win32API.RegisterRawInputDevices(device);

.

    /// Function to register a raw input device.

.

    public static bool RegisterRawInputDevices(RAWINPUTDEVICE device)

.

        RAWINPUTDEVICE[] devices = new RAWINPUTDEVICE[1];        // Raw input devices.

.

        return RegisterRawInputDevices(devices, 1, Marshal.SizeOf(typeof(RAWINPUTDEVICE)));

.
Documentation
[RegisterRawInputDevices] on MSDN
.
Summary
.

The SendInput function synthesizes keystrokes, mouse motions, and button clicks to the currently active window

.

   internal static extern uint SendInput (uint nInputs,

.

      [MarshalAs(UnmanagedType.LPArray), In] INPUT[] pInputs,

.

Friend Shared Function SendInput(<[In]()> ByVal nInput As UInt32,

.

  <[In](), MarshalAs(UnmanagedType.LPArray, ArraySubtype:=UnmanagedType.Struct, SizeParamindex:=0)> ByVal pInputs() As tagINPUT,

.

  <[In]()> ByVal cbInput As Int32) As UInt32

.

Private Declare Function SendInput Lib "user32.dll" (ByVal cInputs As Integer, ByRef pInputs As INPUT, ByVal cbSize As Integer) As Integer

.

INPUT

.

   var pInputs = new[]

.

      new StructLib.INPUT()

.

     type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,

.

     ki = new StructLib.KEYBDINPUT()

.

      new StructLib.INPUT()

.

     type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,

.

     ki = new StructLib.KEYBDINPUT()

.

      new StructLib.INPUT()

.

     type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,

.

     ki = new StructLib.KEYBDINPUT()

.

      new StructLib.INPUT()

.

     type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,

.

     ki = new StructLib.KEYBDINPUT()

.

      new StructLib.INPUT()

.

     type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,

.

     ki = new StructLib.KEYBDINPUT()

.

      new StructLib.INPUT()

.

     type = EnumLib.INPUT_TYPE.INPUT_KEYBOARD,

.

     ki = new StructLib.KEYBDINPUT()

.

   Api.user32.SendInput((uint)pInputs.Length, pInputs, StructLib.INPUT.Size);

.

   $_inputList = New-Object 'Collections.Generic.List[Testing.Windows3+INPUT]'

.

   $_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 ) } ) } ) } ) )

.

   $_inputArray = $_inputList.ToArray()

.

   Start-Sleep 2 ; [Testing.Windows3]::SendInput($_inputArray.count, $_inputArray, [Runtime.InteropServices.marshal]::SizeOf($_inputArray[0]))

.
Documentation
[SendInput] on MSDN
.

    ///     Brings the thread that created the specified window into the foreground and activates the window. Keyboard input is

.

    ///     <item>The process received the last input event.</item>

.

    ///     the foreground window the next time the user generates input, unless the input is directed at that process, or

.

The trick is to make windows ‘think’ that our process and the target window (hwnd) are related by attaching the threads (using AttachThreadInput API) and using an alternative API: BringWindowToTop.

.

        AttachThreadInput(foreThread, appThread, true);

.

        AttachThreadInput(foreThread, appThread, false);

.

    ///         If the calling thread and the thread that owns the window are attached to different input

.

        ///     If the calling thread and the thread that owns the window are attached to different input queues, the system posts the request to the thread that owns the window. This prevents the calling thread from blocking its execution while other threads process the request.

.

///         Installs a hook procedure that records input messages posted to the system message queue. This

.

///         Installs a hook procedure that monitors low-level keyboard input events. For more information,

.

///         Installs a hook procedure that monitors low-level mouse input events. For more information,

.

///         Installs a hook procedure that monitors messages generated as a result of an input event in a

.

http://windowssdk.msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/mouseinput/mouseinputreference/mouseinputfunctions/swapmousebutton.asp

.
Summary
.

static extern uint WaitForInputIdle(IntPtr hProcess, uint dwMilliseconds);

.

Private Shared Function WaitForInputIdle( _

.

Process.WaitForInputIdle()

.
Documentation
[WaitForInputIdle] on MSDN

gdi32

27: Escape
.

static extern int Escape(IntPtr hdc, int nEscape, int cbInput,

.

static extern int ExtEscape(IntPtr hdc, int nEscape, int cbInput,

.

    Public Shared Function ExtEscape(ByVal hdc As IntPtr, ByVal nEscape As Integer, ByVal cbInput As Integer, ByVal lpszInData As String, ByVal cbOutput As Integer, ByRef lpszOutData As IntPtr) As Integer

.

    //Here only to catch errors where input is not a number (EXIT, for example, is a string)        

imm32

.

        bool bSuccess = ImmGetConversionStatus(HIme, ref iMode, ref iSentence);  //Scan the input method info

advapi32

.

      SE_UNSOLICITED_INPUT_NAME,

.

    Public stdInput As IntPtr

.

            public IntPtr stdInput;

.
Summary
The LookupAccountName function accepts the name of a system and an account as input. It retrieves a security identifier (SID) for the account and the name of the domain on which the account was found.
.
Summary
The LookupAccountSid function accepts a security identifier (SID) as input. It retrieves the name of the account for this SID and the name of the first domain on which this SID is found.
.

    'Input format is the format returned from "ConvertStringSidToSid"

.

public const string SE_UNSOLICITED_INPUT_NAME = "SeUnsolicitedInputPrivilege";

.

    ' Setup the input parameters for the LsaRemoveAccountRights API

.

    ' Setup the input parameters for the LsaEnumerateAccountsWithUserRight API

.

    ' Setup the input parameters for the LsaEnumerateAccountsWithUserRight API

.

    ' Setup the input parameters for the LsaRemoveAccountRights API

.

After calling the MapGenericMask function, the access mask pointed to by the AccessMask parameter has none of its generic bits (GenericRead, GenericWrite, GenericExecute, or GenericAll) or undefined bits set, although it can have other bits set. If bits other than the generic bits are provided on input, this function does not clear them.

.

    IntPtr InputArg,

.

internal struct NET_VALIDATE_AUTHENTICATION_INPUT_ARG

.

    public NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;

.

internal struct NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG

.

    public NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;

.

internal struct NET_VALIDATE_PASSWORD_RESET_INPUT_ARG

.

    public NET_VALIDATE_PERSISTED_FIELDS InputPersistedFields;

.

     var inputArgs = new NET_VALIDATE_PASSWORD_CHANGE_INPUT_ARG();

.

     inputArgs.PasswordMatched = true;

.

     inputArgs.UserAccountName = @"accountname";

.

     IntPtr inputPointer = IntPtr.Zero;

.

        inputArgs.ClearPassword = Marshal.StringToBSTR(@"password");

.

        //inputArgs.ClearPassword = Marshal.SecureStringToBSTR(secureStringPassword);

.

        inputPointer = Marshal.AllocHGlobal(Marshal.SizeOf(inputArgs));

.

        Marshal.StructureToPtr(inputArgs, inputPointer, false);        

.

        NET_API_STATUS status = NetValidatePasswordPolicy(serverName, IntPtr.Zero, NET_VALIDATE_PASSWORD_TYPE.NetValidatePasswordChange, inputPointer, ref outputPointer);

.

        if (inputArgs.ClearPassword != IntPtr.Zero)

.

            Marshal.ZeroFreeBSTR(inputArgs.ClearPassword);

.

        if (inputPointer != IntPtr.Zero)

.

            Marshal.FreeHGlobal(inputPointer);

Constants

42: NERR_
.

        /// <summary> 2357 - Could not determine the type of input. </summary>

.

        /// <summary> 2662 - There is no DFS name whose entry path matches the input Entry Path. </summary>

.

    public static PropertyKey WPD_PROPERTY_MTP_EXT_OPERATION_CODE = new PropertyKey(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56, 1001);    // [ VT_UI4 ] : Input param which identifies the vendor-extended MTP operation code

.

    public static PropertyKey WPD_PROPERTY_MTP_EXT_OPERATION_PARAMS = new PropertyKey(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56, 1002);    // [ VT_UNKNOWN ] : Input IPortableDevicePropVariantCollection (of VT_UI4) specifying the params for the vendor operation

.

    public static PropertyKey WPD_PROPERTY_MTP_EXT_TRANSFER_TOTAL_DATA_SIZE = new PropertyKey(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56, 1007);    // [ VT_UI8 ] : Input (when writing data) or output (when reading data) param which specifies total data size in bytes (excluding any overhead)

.

    public static PropertyKey WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_TO_READ = new PropertyKey(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56, 1008); // [ VT_UI4 ] : Input param specifying the number of bytes to read from device in a series of read calls

.

    public static PropertyKey WPD_PROPERTY_MTP_EXT_TRANSFER_NUM_BYTES_TO_WRITE = new PropertyKey(0x4d545058, 0x1a2e, 0x4106, 0xa3, 0x57, 0x77, 0x1e, 0x8, 0x19, 0xfc, 0x56, 1010); // [ VT_UI4 ] : Input specifying the number of bytes to send to device in a series of write calls

.

    public const int SEE_MASK_WAITFORINPUTIDLE  = 0x02000000;

.

    public const int SEE_MASK_WAITFORINPUTIDLE  = 0x02000000;

.

        /// Name translation: Input name mapped to more than one output name.

.

        /// Name translation: Input name found, but not the associated output format.

.

        /// User input required for operation to succeed

.

        /// Common prefix is input moniker

.

        /// An outgoing call cannot be made since the application is dispatching an input-synchronous call.

.

        public const int RPC_E_CANTCALLOUT_ININPUTSYNCCALL = (int)(0x8001010D - 0x100000000);

.

        public const int OSS_MORE_INPUT = (int)(0x80093004 - 0x100000000);

47: WM
.
WM_CHARTOITEM 0x2F Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_CHAR message.
.
WM_GETDLGCODE 0x87 The WM_GETDLGCODE message is sent to the window procedure associated with a control. By default, the system handles all keyboard input to the control; the system interprets certain types of keyboard input as dialog box navigation keys. To override this default behavior, the control can respond to the WM_GETDLGCODE message to indicate the types of input it wants to process itself.
.
WM_INPUTLANGCHANGE 0x51 The WM_INPUTLANGCHANGE message is sent to the topmost affected window after an application's input language has been changed. You should make any application-specific settings and pass the message to the DefWindowProc function, which passes the message to all first-level child windows. These child windows can pass the message to DefWindowProc to have it pass the message to their child windows, and so on.
.
WM_INPUTLANGCHANGEREQUEST 0x50 The WM_INPUTLANGCHANGEREQUEST message is posted to the window with the focus when the user chooses a new input language, either with the hotkey (specified in the Keyboard control panel application) or from the indicator on the system taskbar. An application can accept the change by passing the message to the DefWindowProc function or reject the change (and prevent it from taking place) by returning immediately.
.
WM_QUEUESYNC 0x23 The WM_QUEUESYNC message is sent by a computer-based training (CBT) application to separate user-input messages from other messages sent through the WH_JOURNALPLAYBACK Hook procedure.
.
WM_SETCURSOR 0x20 The WM_SETCURSOR message is sent to a window if the mouse causes the cursor to move within a window and mouse input is not captured.
.
WM_VKEYTOITEM 0x2E Sent by a list box with the LBS_WANTKEYBOARDINPUT style to its owner in response to a WM_KEYDOWN message.
.

private const UInt32 WM_INPUTLANGCHANGE    = 0x0051;

.

private const UInt32 WM_INPUTLANGCHANGEREQUEST = 0x0050;

.

   WM_INPUTLANGCHANGE = &H51

.

   WM_INPUTLANGCHANGEREQUEST = &H50

.

WM_INPUTLANGCHANGEREQUEST equ 050h

.

WM_INPUTLANGCHANGE    equ 051h

msvcrt

48: kbhit
.
Summary
Checks the console for keyboard input.
.

System.Console.KeyAvailable() - Gets a value indicating whether a key press is available in the input stream. (Nonblocking)

49: scanf
.
Summary
Read formatted data from standard input

ncrypt

.

                [MarshalAs(UnmanagedType.LPArray)] byte[] pbInput,

.

                int cbInput,

.

            [MarshalAs(UnmanagedType.LPArray)] byte[] pbInput,

.

            int cbInput,

.

    IntPtr pbInputByteArray,

.

    int cbInput,

.

  When the input is a 4 byte DWORD; you may also use this:

.

                            ref int pbInput,

.

                            int cbInput,

powrprof

.

     IntPtr lpInputBuffer,

.

     UInt32 nInputBufferSize,

.

Private Shared Function CallNtPowerInformation(InformationLevel As Int32, lpInputBuffer As IntPtr, nInputBufferSize As UInt32, lpOutputBuffer As IntPtr, nOutputBufferSize As UInt32) As UInt32

.

        IntPtr lpInputBuffer,

.

        int nInputBufferSize,

.

    private const int PBT_APMRESUMESUSPEND = 7; // (0x7) - Operation is resuming from a low-power state.This message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key.

.

            Console.WriteLine("\tOperation is resuming from a low-power state.This message is sent after PBT_APMRESUMEAUTOMATIC if the resume is triggered by user input, such as pressing a key.");

kernel32

.

    // http://pinvoke.net/default.aspx/kernel32/FlushConsoleInputBuffer.html

.

    static extern bool FlushConsoleInputBuffer(

.

        IntPtr hConsoleInput

.

    // http://pinvoke.net/default.aspx/kernel32/GetNumberOfConsoleInputEvents.html

.

    static extern bool GetNumberOfConsoleInputEvents(

.

        IntPtr hConsoleInput,

.

    // http://pinvoke.net/default.aspx/kernel32/PeekConsoleInput.html

.

    static extern bool PeekConsoleInput(

.

        IntPtr hConsoleInput,

.

        [Out] INPUT_RECORD[] lpBuffer,

.

        IntPtr hConsoleInput,

.

    // http://pinvoke.net/default.aspx/kernel32/ReadConsoleInput.html

.

    [DllImport("kernel32.dll", EntryPoint = "ReadConsoleInputW", CharSet = CharSet.Unicode)]

.

    static extern bool ReadConsoleInput(

.

        IntPtr hConsoleInput,

.

        [Out] INPUT_RECORD[] lpBuffer,

.

    // http://pinvoke.net/default.aspx/kernel32/WriteConsoleInput.html

.

    static extern bool WriteConsoleInput(

.

        IntPtr hConsoleInput,

.

        INPUT_RECORD[] lpBuffer,

.

    public struct INPUT_RECORD

.

        uint nInBufferSize,                            // input buffer size

.

       Dim bBuffer As Byte       ' Input buffer.

.
Summary
.

static extern bool FlushConsoleInputBuffer(IntPtr hConsoleInput);

.

This code segment will allow you to grab the Console input buffer using CreateFileW and Flush the input using FlushConsoleInputBuffer

.

  private static extern bool FlushConsoleInputBuffer(IntPtr hConsoleInput);

.

  private static extern IntPtr GetInputBuffer(

.

  //C# method to flush console input

.

    //"CONIN$" will allow you to grab the input buffer regardless if it is being redirected.

.

    IntPtr inBuffer = GetInputBuffer("CONIN$", 0x40000000 | 0x80000000,

.

    //throw an error if the input buffer is not obtained

.

    FlushConsoleInputBuffer(inBuffer);

.
Documentation
[FlushConsoleInputBuffer] on MSDN
.

    /* Retrieves the input code page used by the console associated with the calling process.

.

        A console uses its input code page to translate keyboard input into the corresponding character value. */

.

System.Console.InputEncoding.CodePage

.

    ENABLE_PROCESSED_INPUT = &H1

.

    ENABLE_LINE_INPUT = &H2

.

    ENABLE_ECHO_INPUT = &H4

.

    ENABLE_WINDOW_INPUT = &H8

.

    ENABLE_MOUSE_INPUT = &H10

Cut off search results after 60. Please refine your search.


 
Access PInvoke.net directly from VS: