Esempio n. 1
0
        private void CheckTappingProperty()
        {
            var tapEnabled = _synTouchPad.GetLongProperty(SynDeviceProperty.SP_IsTapEnabled);

            if (tapEnabled == 0)
            {
                _synTouchPad.SetLongProperty(SynDeviceProperty.SP_IsTapEnabled, 1);
            }

            /*
             * var dragEnabled = _synTouchPad.GetLongProperty(SYNCTRLLib.SynDeviceProperty.SP_IsDragEnabled);
             * if (dragEnabled == 0) _synTouchPad.SetLongProperty(SYNCTRLLib.SynDeviceProperty.SP_IsDragEnabled, 1);
             *
             * var cornerTapEnabled = _synTouchPad.GetLongProperty(SYNCTRLLib.SynDeviceProperty.SP_IsCornerTapEnabled);
             * if (cornerTapEnabled == 1) _synTouchPad.SetLongProperty(SYNCTRLLib.SynDeviceProperty.SP_IsCornerTapEnabled, 0);
             */
        }
Esempio n. 2
0
        public Fingers()
        {
            api = new SynAPICtrlClass();
            api.Initialize();
            int deviceHandle = 0;
            deviceHandle = api.FindDevice(SynConnectionType.SE_ConnectionUSB, SynDeviceType.SE_DeviceForcePad, -1);
            device = new SynDeviceCtrlClass();
            device.Select(deviceHandle);
            device.Activate();
            device.OnPacket += device_OnPacket;

            device.SetLongProperty(SynDeviceProperty.SP_IsMultiFingerReportEnabled, 1);
            device.SetLongProperty(SynDeviceProperty.SP_IsGroupReportEnabled, 1);
            minX = device.GetLongProperty(SynDeviceProperty.SP_XLoBorder);
            maxX = device.GetLongProperty(SynDeviceProperty.SP_XHiBorder);
            minY = device.GetLongProperty(SynDeviceProperty.SP_YLoBorder);
            maxY = device.GetLongProperty(SynDeviceProperty.SP_YHiBorder);
            numForces = device.GetLongProperty(SynDeviceProperty.SP_NumForceSensors);
        }
Esempio n. 3
0
        private void Form1_Load(object sender, EventArgs e)
        {
            try
            {
                // Get the SID of the admin group on the local machine.
                var localAdminGroupSid = new SecurityIdentifier(
                    WellKnownSidType.BuiltinAdministratorsSid, null);
                WindowsIdentity windowsIdentity = WindowsIdentity.GetCurrent();

                //Then you can check the Groups property on the WindowsIdentity of the user to see if that user is a member of the local admin group, like so:
                bool isLocalAdmin = windowsIdentity.Groups.
                                    Select(g => (SecurityIdentifier)g.Translate(typeof(SecurityIdentifier))).
                                    Any(s => s == localAdminGroupSid);
                if (isLocalAdmin)
                {
                    adminButton.Visible = false;
                }
            }
            catch (Exception) { }
            synAPI.Initialize();
            synAPI.Activate();
            DeviceHandle = synAPI.FindDevice(SynConnectionType.SE_ConnectionAny, SynDeviceType.SE_DeviceTouchPad, -1);
            if (DeviceHandle == -1)
            {
                MessageBox.Show("Unable to find a Synaptics TouchPad");
            }
            else
            {
                synDev.Select(DeviceHandle);
                synDev.Activate();
                oldDisableState = synDev.GetLongProperty(SynDeviceProperty.SP_DisableState);
                synDev.SetLongProperty(SynDeviceProperty.SP_DisableState, 0);
                bool     s    = TouchInjector.InitializeTouchInjection(256, TouchFeedback.INDIRECT);//initialize with default settings
                Settings sett = Settings.Default;
                hideBox.Checked = sett.HideToTaskbar;
                if (sett.XMin != 0)
                {
                    XMin = sett.XMin;
                }
                else
                {
                    XMin = synDev.GetLongProperty(SynDeviceProperty.SP_XLoSensor);
                }
                if (sett.XMax != 0)
                {
                    XMax = sett.XMax;
                }
                else
                {
                    XMax = synDev.GetLongProperty(SynDeviceProperty.SP_XHiSensor);
                }
                if (sett.YMin != 0)
                {
                    YMin = sett.YMin;
                }
                else
                {
                    YMin = synDev.GetLongProperty(SynDeviceProperty.SP_YLoSensor);
                }
                if (sett.YMax != 0)
                {
                    YMax = sett.YMax;
                }
                else
                {
                    YMax = synDev.GetLongProperty(SynDeviceProperty.SP_YHiSensor);
                }
                ZTouchThreshold = synDev.GetLongProperty(SynDeviceProperty.SP_ZTouchThreshold) + 20;
                wHeight         = GetScreen().Height - 1;
                wWidth          = GetScreen().Width - 1;
                synDev.Acquire(0);
                updateCalibrationStatusLabel();

                synDev.OnPacket += synDev_OnPacket;
            }
        }