示例#1
0
        /// <summary>
        /// Trigger a releasing mouse button events.
        /// </summary>
        /// <param name="button">button type: "left", "middle", "right"</param>
        /// <returns>true for success</returns>
        public bool MouseUp(string button) {
            MouseInput mi = new MouseInput( 0 );
            switch( button ) {
                case "left":
                    mi.dwFlags |= MouseInput.MOUSEEVENTF_LEFTUP;
                    break;

                case "right":
                    mi.dwFlags |= MouseInput.MOUSEEVENTF_RIGHTUP;
                    break;

                case "middle":
                    mi.dwFlags |= MouseInput.MOUSEEVENTF_MIDDLEUP;
                    break;

                default:
                    return false;
            }

            if (mi.dwFlags != 0) {
                if (0 == Win32Api.SendMouseInput( 1, ref mi, Marshal.SizeOf( mi ) )) {
                    return false;
                }
                Application.DoEvents();
            }
            return true;
        }
示例#2
0
 internal static extern int SendMouseInput( int cInputs, ref MouseInput pInputs, int cbSize );