private void FormClose(object sender, FormClosingEventArgs e) { foreach (var id in _windowId) { WindowsApi.UnregisterHotKey(Handle, id); } }
private void FormClose(object sender, FormClosingEventArgs e) { WindowsApi.UnregisterHotKey(Handle, _windowId); if (clipboardButton.Checked) { _registryKey.SetValue("LastPath", "*" + folderTextBox.Text); } else { _registryKey.SetValue("LastPath", folderTextBox.Text); } // Save resizing settings in an 8-byte long var b = new byte[8]; b[0] = (byte)(resizeCheckbox.Checked ? 1 : 0); b[3] = (byte)((int)windowWidth.Value & 0xff); b[2] = (byte)(((int)windowWidth.Value >> 8) & 0xff); b[1] = (byte)(((int)windowWidth.Value >> 16) & 0xff); b[6] = (byte)((int)windowHeight.Value & 0xff); b[5] = (byte)(((int)windowHeight.Value >> 8) & 0xff); b[4] = (byte)(((int)windowHeight.Value >> 16) & 0xff); long data = BitConverter.ToInt64(b, 0); _registryKey.SetValue("WindowSize", data, RegistryValueKind.QWord); // Save background colour settings in an 8-byte long b = new byte[8]; b[0] = (byte)(opaqueCheckbox.Checked ? 1 : 0); b[0] += (byte)Math.Pow(2, opaqueType.SelectedIndex + 1); b[1] = (byte)(checkerValue.Value - 2); b[2] = colourDialog.Color.R; b[3] = colourDialog.Color.G; b[4] = colourDialog.Color.B; data = BitConverter.ToInt64(b, 0); _registryKey.SetValue("Opaque", data, RegistryValueKind.QWord); _registryKey.SetValue("CapturePointer", mouseCheckbox.Checked ? 1 : 0, RegistryValueKind.DWord); }