public SynapticsAPI() { synAPICtrl = new SynAPICtrl(); synAPICtrl.Initialize(); synAPICtrl.Activate(); CreateDeviceList(); }
public void Resume() { //this is necessery after coming back from standby/hibernation _log.LogDebug("resuming..."); _synApi = new SynAPICtrl(); _synTouchPad = new SynDeviceCtrl(); _synApi.Initialize(); _synApi.Activate(); _devHandle = _synApi.FindDevice( SynConnectionType.SE_ConnectionAny, SynDeviceType.SE_DeviceTouchPad, -1); if (_devHandle < 0) { //I know, this should be async... Thread.Sleep(500); Resume(); return; } _synTouchPad.Select(_devHandle); _synTouchPad.Activate(); _synTouchPad.OnPacket += OnPacket; ReadDeviceProperties(); }
public Form1() { InitializeComponent(); synAPI = new SynAPICtrlClass(); synDev = new SynDeviceCtrlClass(); synPacket = new SynPacketCtrlClass(); }
public API() { try { APICtrl = new SynAPICtrl(); Device = new SynDeviceCtrl(); Packet = new SynPacketCtrl(); IsAvailable = true; Init(); } catch (COMException) { IsAvailable = false; } }
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); }
private void Main_Load(object sender, EventArgs e) { // Initialize the Synaptics API SynCtrl = new SynAPICtrl(); SynDevCtrl = new SynDeviceCtrl(); SynCtrl.Initialize(); // Set UI Elements trackBar1.Value = scrollSpeed; displayScrollDirection(); initTouchpad(); // Touchpad Event Handler SynDevCtrl.OnPacket += new _ISynDeviceCtrlEvents_OnPacketEventHandler(SynDevCtrl_OnPacket); // Power Event Handlers SystemEvents.SessionSwitch += new SessionSwitchEventHandler(SystemEvents_SessionSwitch); Microsoft.Win32.SystemEvents.PowerModeChanged += new PowerModeChangedEventHandler(SystemEvents_PowerModeChanged); }
public SearchResultsView() { InitializeComponent(); SearchResultsListView.ItemsSource = EverythingSearch.Instance.SearchResults; ((INotifyCollectionChanged)SearchResultsListView.Items).CollectionChanged += OnCollectionChanged; #if SYNAPTICS try { api = new SynAPICtrl(); synTouchPad = new SynDeviceCtrl(); synPacket = new SynPacketCtrl(); api.Initialize(); api.Activate(); deviceHandle = api.FindDevice(SynConnectionType.SE_ConnectionAny, SynDeviceType.SE_DeviceTouchPad, -1); synTouchPad.Select(deviceHandle); synTouchPad.Activate(); synTouchPad.OnPacket += OnSynapticsPacket; } catch (COMException) { } #endif }
public bool Init() { _log = new Logger(); try { _log.LogDebug("Create SynAPI"); _synApi = new SynAPICtrl(); _log.LogDebug("Create SynDeviceCtrl"); _synTouchPad = new SynDeviceCtrl(); _log.LogDebug("Init SynAPI"); _synApi.Initialize(); _synApi.Activate(); _log.LogDebug("Find Synaptics Device"); _devHandle = _synApi.FindDevice( SynConnectionType.SE_ConnectionAny, SynDeviceType.SE_DeviceTouchPad, -1); _synTouchPad.Select(_devHandle); _synTouchPad.Activate(); _log.LogDebug("Create OnPacketEventHandler"); _synTouchPad.OnPacket += OnPacket; } catch (Exception ex) { _log.LogDebug("Error on init: " + ex.InnerException.Message); MessageBox.Show( Resources.error_startup_no_driver_found, Resources.error_msg_title, MessageBoxButtons.OK, MessageBoxIcon.Error ); Application.Exit(); return(false); } if (_devHandle < 0) { _log.LogDebug("No device handle found"); MessageBox.Show(Resources.error_startup_no_device_found, Resources.error_msg_title, MessageBoxButtons.OK, MessageBoxIcon.Error); Application.Exit(); return(false); } _log.LogDebug("Device handle found: " + _devHandle); //check if the touchpad has support for multiple fingers var multi = _synTouchPad.GetLongProperty(SynDeviceProperty.SP_IsMultiFingerCapable); if (multi < 0) { //HKLM "System\\CurrentControlSet\\Services\\SynTP\\Parameters" -> CapabilitiesMask must be 0xFFFFFFFF var parampath = @"System\CurrentControlSet\Services\SynTP\Parameters"; var key = Registry.LocalMachine.CreateSubKey(parampath); key.SetValue("CapabilitiesMask", 0xFFFFFFFF); MessageBox.Show("Multiple finger support was missing. We made some changes to the registry.\n\nTry running SynGestures again or reboot your computer and try again then.", Resources.error_msg_title, MessageBoxButtons.OK, MessageBoxIcon.Information); Application.Exit(); return(false); } ReadDeviceProperties(); return(true); }