/// <summary>
        /// Creates a key event wrapped in a inputUnion structure. Passed to: <see cref="NativeMethods.SendInput(uint, Input[], int)"/>
        /// </summary>
        /// <param name="wScan">The scan keycode</param>
        /// <param name="dwFlags">dword flags</param>
        /// <param name="time">the time?</param>
        /// <param name="dwExtraInfo">dword extra info</param>
        /// <returns></returns>
        private static InputUnion createKeyEvent(VirtualKeyShort wVk, KeyEventF dwFlags, int time, UIntPtr dwExtraInfo)
        {
            // Written, 08.10.2020

            InputUnion result = new InputUnion
            {
                ki = new KeyboardInput()
                {
                    dwExtraInfo = dwExtraInfo,
                    dwFlags     = dwFlags,
                    time        = time,
                    wVk         = wVk,
                }
            };

            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates required stuff to simulate mouse movement.
        /// </summary>
        /// <param name="x">The x.</param>
        /// <param name="y">The y.</param>
        /// <param name="data">Data to pass.</param>
        /// <param name="time">The time of event.</param>
        /// <param name="flag">flags to pass.</param>
        private static InputUnion createMouseInput(int x, int y, uint data, uint time, MouseEventF flag)
        {
            // Written, 06.10.2020

            InputUnion result = new InputUnion
            {
                mi = new MouseInput()
                {
                    dx        = x,
                    dy        = y,
                    mouseData = data,
                    time      = time,
                    dwFlags   = flag
                }
            };

            return(result);
        }