diff --git a/FileViewer.cs b/FileViewer.cs
index f25564f..c3f9708 100644
--- a/FileViewer.cs
+++ b/FileViewer.cs
@@ -246,7 +246,7 @@ namespace MeshCentralRouter
updateLocalFileView();
// Restore Window Location
- string locationStr = getRegValue("filelocation", "");
+ string locationStr = Settings.GetRegValue("filelocation", "");
if (locationStr != null)
{
string[] locationSplit = locationStr.Split(',');
@@ -615,7 +615,7 @@ namespace MeshCentralRouter
node.fileViewer = null;
// Save window location
- setRegValue("filelocation", Location.X + "," + Location.Y + "," + Size.Width + "," + Size.Height);
+ Settings.SetRegValue("filelocation", Location.X + "," + Location.Y + "," + Size.Width + "," + Size.Height);
}
public delegate void displayMessageHandler(string msg);
@@ -1216,15 +1216,6 @@ namespace MeshCentralRouter
}
}
- public void setRegValue(string name, string value)
- {
- try { Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value); } catch (Exception) { }
- }
- public string getRegValue(string name, string value)
- {
- try { return Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value).ToString(); } catch (Exception) { return value; }
- }
-
bool isPointVisibleOnAScreen(Point p)
{
foreach (Screen s in Screen.AllScreens) { if ((p.X < s.Bounds.Right) && (p.X > s.Bounds.Left) && (p.Y > s.Bounds.Top) && (p.Y < s.Bounds.Bottom)) return true; }
diff --git a/KVMControl.cs b/KVMControl.cs
index 833a660..f2cf056 100644
--- a/KVMControl.cs
+++ b/KVMControl.cs
@@ -48,7 +48,10 @@ namespace MeshCentralRouter
public double DpiX = 96;
public double DpiY = 96;
public KVMViewer parent = null;
+ private readonly KVMControlHook ControlHook;
private readonly KVMControlHook.KVMCallback KeyboardCallback;
+ private bool isHookWanted;
+ private bool isHookPriority;
private bool keyboardIsAttached;
private long killNextKeyPress = 0;
@@ -131,14 +134,32 @@ namespace MeshCentralRouter
this.SetStyle(ControlStyles.UserPaint, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.MouseWheel += new System.Windows.Forms.MouseEventHandler(KVMControl_MouseWheel);
- KeyboardCallback = SendKey;
+ if (Settings.GetRegValue("Exp_KeyboardHook", false))
+ {
+ ControlHook = new KVMControlHook();
+ KeyboardCallback = SendKey;
+ isHookWanted = true;
+ }
+ else
+ {
+ isHookWanted = false;
+ }
+ if (Settings.GetRegValue("Exp_KeyboardHookPriority", false))
+ {
+ isHookPriority = true;
+ }
+ else
+ {
+ isHookPriority = false;
+ }
}
public void AttachKeyboard()
{
- if (!keyboardIsAttached)
+ Console.WriteLine(isHookWanted);
+ if (!keyboardIsAttached && isHookWanted)
{
- Program.controlHook.AttachCallback(KeyboardCallback);
+ ControlHook.AttachKeyboardHook(SendKey);
keyboardIsAttached = true;
}
}
@@ -147,7 +168,7 @@ namespace MeshCentralRouter
{
if (keyboardIsAttached)
{
- Program.controlHook.DetachCallback();
+ ControlHook.DetachKeyboardHook();
keyboardIsAttached = false;
}
}
@@ -687,21 +708,30 @@ namespace MeshCentralRouter
private void KVMControl_KeyDown(object sender, KeyEventArgs e)
{
- if ((e.KeyCode == Keys.LWin) || (e.KeyCode == Keys.RWin)) return; // Don't process the Windows key
- SendKey(e, 0);
- e.Handled = true;
+ if (!isHookPriority)
+ {
+ if ((e.KeyCode == Keys.LWin) || (e.KeyCode == Keys.RWin)) return; // Don't process the Windows key
+ SendKey(e, 0);
+ e.Handled = true;
+ }
}
private void KVMControl_KeyPress(object sender, KeyPressEventArgs e)
{
- SendPress(e, 0);
- e.Handled = true;
+ if (!isHookPriority)
+ {
+ SendPress(e, 0);
+ e.Handled = true;
+ }
}
private void KVMControl_KeyUp(object sender, KeyEventArgs e)
{
- SendKey(e, 1);
- e.Handled = true;
+ if (!isHookPriority)
+ {
+ SendKey(e, 1);
+ e.Handled = true;
+ }
}
protected override bool ProcessCmdKey(ref Message msg, Keys keyData)
diff --git a/KVMControlHook.cs b/KVMControlHook.cs
index 1565239..c32346f 100644
--- a/KVMControlHook.cs
+++ b/KVMControlHook.cs
@@ -15,14 +15,14 @@ namespace MeshCentralRouter
internal KVMControlHook()
{
_proc = HookCallback;
- AttachKeyboardHook();
}
- private void AttachKeyboardHook()
+ internal void AttachKeyboardHook(KVMCallback callback)
{
try
{
_hook = KVMKeyboardHook.SetHook(_proc);
+ _callback = callback;
}
catch
{
@@ -31,18 +31,9 @@ namespace MeshCentralRouter
}
}
- internal void AttachCallback(KVMCallback callback)
- {
- _callback = callback;
- }
-
- internal void DetachCallback()
+ internal void DetachKeyboardHook()
{
_callback = null;
- }
-
- internal static void DetachKeyboardHook()
- {
if (_hook != IntPtr.Zero)
KVMKeyboardHook.UnhookWindowsHookEx(_hook);
}
diff --git a/KVMViewer.cs b/KVMViewer.cs
index 658a750..4011c7d 100644
--- a/KVMViewer.cs
+++ b/KVMViewer.cs
@@ -80,7 +80,7 @@ namespace MeshCentralRouter
topPanel.Visible = true;
// Restore Window Location
- string locationStr = getRegValue("kvmlocation", "");
+ string locationStr = Settings.GetRegValue("kvmlocation", "");
if (locationStr != null)
{
string[] locationSplit = locationStr.Split(',');
@@ -319,7 +319,7 @@ namespace MeshCentralRouter
closeKvmStats();
// Save window location
- setRegValue("kvmlocation", Location.X + "," + Location.Y + "," + Size.Width + "," + Size.Height);
+ Settings.SetRegValue("kvmlocation", Location.X + "," + Location.Y + "," + Size.Width + "," + Size.Height);
}
private void toolStripMenuItem2_DropDownOpening(object sender, EventArgs e)
@@ -446,15 +446,6 @@ namespace MeshCentralRouter
//kvmControl.SendCharmsKey();
}
- public static void saveToRegistry(string name, string value)
- {
- try { Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\OpenSource\MeshRouter", name, value); } catch (Exception) { }
- }
- public static string loadFromRegistry(string name)
- {
- try { return Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\OpenSource\MeshRouter", name, "").ToString(); } catch (Exception) { return ""; }
- }
-
public delegate void displayMessageHandler(string msg);
public void displayMessage(string msg)
{
@@ -534,15 +525,6 @@ namespace MeshCentralRouter
kvmControl.AttachKeyboard();
}
- public void setRegValue(string name, string value)
- {
- try { Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value); } catch (Exception) { }
- }
- public string getRegValue(string name, string value)
- {
- try { return Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value).ToString(); } catch (Exception) { return value; }
- }
-
bool isPointVisibleOnAScreen(Point p)
{
foreach (Screen s in Screen.AllScreens) { if ((p.X < s.Bounds.Right) && (p.X > s.Bounds.Left) && (p.Y > s.Bounds.Top) && (p.Y < s.Bounds.Bottom)) return true; }
diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs
index e132047..95fd5e6 100644
--- a/MainForm.Designer.cs
+++ b/MainForm.Designer.cs
@@ -612,6 +612,7 @@
this.devicesListView.FullRowSelect = true;
this.devicesListView.GridLines = true;
this.devicesListView.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
+ this.devicesListView.HideSelection = false;
this.devicesListView.LargeImageList = this.devicesImageList;
resources.ApplyResources(this.devicesListView, "devicesListView");
this.devicesListView.MultiSelect = false;
@@ -920,7 +921,7 @@
this.toolStripMenuItem5.Name = "toolStripMenuItem5";
resources.ApplyResources(this.toolStripMenuItem5, "toolStripMenuItem5");
//
- // settingsToolStripMenuItem1
+ // ToolStripMenuItem1
//
this.settingsToolStripMenuItem1.Name = "settingsToolStripMenuItem1";
resources.ApplyResources(this.settingsToolStripMenuItem1, "settingsToolStripMenuItem1");
diff --git a/MainForm.cs b/MainForm.cs
index 0b8c893..dfbef38 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -87,6 +87,7 @@ namespace MeshCentralRouter
{
if (IsAdministrator() == false)
{
+
// Restart program and run as admin
var exeName = System.Diagnostics.Process.GetCurrentProcess().MainModule.FileName;
ProcessStartInfo startInfo = new ProcessStartInfo(exeName, "-install");
@@ -141,14 +142,6 @@ namespace MeshCentralRouter
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern Int32 SendMessage(IntPtr hWnd, int msg, int wParam, [MarshalAs(UnmanagedType.LPWStr)]string lParam);
- public void setRegValue(string name, string value)
- {
- try { Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value); } catch (Exception) { }
- }
- public string getRegValue(string name, string value)
- {
- try {return Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value).ToString(); } catch (Exception) { return value; }
- }
public MainForm(string[] args)
{
@@ -165,8 +158,14 @@ namespace MeshCentralRouter
Version version = Assembly.GetEntryAssembly().GetName().Version;
versionLabel.Text = "v" + version.Major + "." + version.Minor + "." + version.Build;
- serverNameComboBox.Text = getRegValue("ServerName", "");
- userNameTextBox.Text = getRegValue("UserName", "");
+ // Prevent edgecase where the hook priority can be on and the hook disabled causing havoc
+ if( !Settings.GetRegValue("Exp_KeyboardHook", false) )
+ {
+ Settings.SetRegValue("Exp_KeyboardHookPriority", false);
+ }
+
+ serverNameComboBox.Text = Settings.GetRegValue("ServerName", "");
+ userNameTextBox.Text = Settings.GetRegValue("UserName", "");
title = this.Text;
int argflags = 0;
@@ -247,7 +246,7 @@ namespace MeshCentralRouter
installButton.Visible = !isRouterHooked();
// Right click action
- deviceDoubleClickAction = int.Parse(getRegValue("DevDoubleClickClickAction", "0"));
+ deviceDoubleClickAction = int.Parse(Settings.GetRegValue("DevDoubleClickClickAction", "0"));
setDoubleClickDeviceAction();
}
@@ -283,9 +282,9 @@ namespace MeshCentralRouter
private void MainForm_Load(object sender, EventArgs e)
{
// Load registry settings
- showGroupNamesToolStripMenuItem.Checked = (getRegValue("Show Group Names", "1") == "1");
- showOfflineDevicesToolStripMenuItem.Checked = (getRegValue("Show Offline Devices", "1") == "1");
- if (getRegValue("Device Sort", "Name") == "Name") {
+ showGroupNamesToolStripMenuItem.Checked = (Settings.GetRegValue("Show Group Names", "1") == "1");
+ showOfflineDevicesToolStripMenuItem.Checked = (Settings.GetRegValue("Show Offline Devices", "1") == "1");
+ if (Settings.GetRegValue("Device Sort", "Name") == "Name") {
sortByNameToolStripMenuItem.Checked = true;
sortByGroupToolStripMenuItem.Checked = false;
} else {
@@ -323,7 +322,7 @@ namespace MeshCentralRouter
}
// Restore Window Location
- string locationStr = getRegValue("location", "");
+ string locationStr = Settings.GetRegValue("location", "");
if (locationStr != null)
{
string[] locationSplit = locationStr.Split(',');
@@ -379,7 +378,7 @@ namespace MeshCentralRouter
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
{
if ((notifyIcon.Visible == true) && (forceExit == false)) { e.Cancel = true; Visible = false; }
- setRegValue("Location", Location.X + "," + Location.Y);
+ Settings.SetRegValue("Location", Location.X + "," + Location.Y);
}
private void backButton5_Click(object sender, EventArgs e)
@@ -423,12 +422,12 @@ namespace MeshCentralRouter
}
else
{
- string ignoreCert = getRegValue("IgnoreCert", null);
+ string ignoreCert = Settings.GetRegValue("IgnoreCert", null);
if (ignoreCert != null) { meshcentral.okCertHash = ignoreCert; }
}
// Load two factor cookie if present
- string twoFactorCookie = getRegValue("TwoFactorCookie", null);
+ string twoFactorCookie = Settings.GetRegValue("TwoFactorCookie", null);
if ((twoFactorCookie != null) && (twoFactorCookie != "")) { twoFactorCookie = "cookie=" + twoFactorCookie; } else { twoFactorCookie = null; }
Uri serverurl = null;
@@ -467,13 +466,13 @@ namespace MeshCentralRouter
private void Meshcentral_onTwoFactorCookie(string cookie)
{
if (this.InvokeRequired) { this.Invoke(new MeshCentralServer.twoFactorCookieHandler(Meshcentral_onTwoFactorCookie), cookie); return; }
- setRegValue("TwoFactorCookie", cookie);
+ Settings.SetRegValue("TwoFactorCookie", cookie);
}
private void nextButton3_Click(object sender, EventArgs e)
{
// If we need to remember this certificate
- if (rememberCertCheckBox.Checked) { setRegValue("IgnoreCert", lastBadConnectCert.GetCertHashString()); }
+ if (rememberCertCheckBox.Checked) { Settings.SetRegValue("IgnoreCert", lastBadConnectCert.GetCertHashString()); }
// Attempt to login, ignore bad cert.
addButton.Enabled = false;
@@ -501,7 +500,7 @@ namespace MeshCentralRouter
meshcentral.connect(serverurl, null, null, null);
} else {
// Load two factor cookie if present
- string twoFactorCookie = getRegValue("TwoFactorCookie", null);
+ string twoFactorCookie = Settings.GetRegValue("TwoFactorCookie", null);
if ((twoFactorCookie != null) && (twoFactorCookie != "")) { twoFactorCookie = "cookie=" + twoFactorCookie; } else { twoFactorCookie = null; }
int keyIndex = serverNameComboBox.Text.IndexOf("?key=");
if (keyIndex >= 0)
@@ -816,8 +815,8 @@ namespace MeshCentralRouter
addButton.Focus();
if (authLoginUrl == null)
{
- setRegValue("ServerName", serverNameComboBox.Text);
- setRegValue("UserName", userNameTextBox.Text);
+ Settings.SetRegValue("ServerName", serverNameComboBox.Text);
+ Settings.SetRegValue("UserName", userNameTextBox.Text);
}
if (meshcentral.username != null) {
this.Text = title + " - " + meshcentral.username;
@@ -1067,7 +1066,7 @@ namespace MeshCentralRouter
if (lastBadConnectCert != null) {
meshcentral.okCertHash = lastBadConnectCert.GetCertHashString();
} else {
- string ignoreCert = getRegValue("IgnoreCert", null);
+ string ignoreCert = Settings.GetRegValue("IgnoreCert", null);
if (ignoreCert != null) { meshcentral.okCertHash = ignoreCert; }
}
meshcentral.onStateChanged += Meshcentral_onStateChanged;
@@ -1228,9 +1227,14 @@ namespace MeshCentralRouter
SettingsForm f = new SettingsForm();
f.BindAllInterfaces = inaddrany;
f.ShowSystemTray = (notifyIcon.Visible == true);
+ f.Exp_KeyboardHookPriority = Settings.GetRegValue("Exp_KeyboardHookPriority", false);
+ f.Exp_KeyboardHook = Settings.GetRegValue("Exp_KeyboardHook", false);
+
if (f.ShowDialog(this) == DialogResult.OK)
{
inaddrany = f.BindAllInterfaces;
+ Settings.SetRegValue("Exp_KeyboardHook", f.Exp_KeyboardHook.ToString().ToLower());
+ Settings.SetRegValue("Exp_KeyboardHookPriority", f.Exp_KeyboardHookPriority.ToString().ToLower());
if (f.ShowSystemTray) {
notifyIcon.Visible = true;
this.ShowInTaskbar = false;
@@ -1378,14 +1382,14 @@ namespace MeshCentralRouter
private void showGroupNamesToolStripMenuItem_Click(object sender, EventArgs e)
{
showGroupNamesToolStripMenuItem.Checked = !showGroupNamesToolStripMenuItem.Checked;
- setRegValue("Show Group Names", showGroupNamesToolStripMenuItem.Checked ? "1" : "0");
+ Settings.SetRegValue("Show Group Names", showGroupNamesToolStripMenuItem.Checked ? "1" : "0");
updateDeviceList();
}
private void hideOfflineDevicesToolStripMenuItem_Click(object sender, EventArgs e)
{
showOfflineDevicesToolStripMenuItem.Checked = !showOfflineDevicesToolStripMenuItem.Checked;
- setRegValue("Show Offline Devices", showOfflineDevicesToolStripMenuItem.Checked?"1":"0");
+ Settings.SetRegValue("Show Offline Devices", showOfflineDevicesToolStripMenuItem.Checked?"1":"0");
updateDeviceList();
}
@@ -1393,7 +1397,7 @@ namespace MeshCentralRouter
{
sortByNameToolStripMenuItem.Checked = true;
sortByGroupToolStripMenuItem.Checked = false;
- setRegValue("Device Sort", "Name");
+ Settings.SetRegValue("Device Sort", "Name");
updateDeviceList();
}
@@ -1401,7 +1405,7 @@ namespace MeshCentralRouter
{
sortByNameToolStripMenuItem.Checked = false;
sortByGroupToolStripMenuItem.Checked = true;
- setRegValue("Device Sort", "Group");
+ Settings.SetRegValue("Device Sort", "Group");
updateDeviceList();
}
@@ -1712,7 +1716,7 @@ namespace MeshCentralRouter
if (f.ShowDialog(this) == DialogResult.OK)
{
deviceDoubleClickAction = f.deviceDoubleClickAction;
- setRegValue("DevDoubleClickClickAction", deviceDoubleClickAction.ToString());
+ Settings.SetRegValue("DevDoubleClickClickAction", deviceDoubleClickAction.ToString());
setDoubleClickDeviceAction();
if (f.ShowSystemTray)
{
diff --git a/MeshCentralRouter.csproj b/MeshCentralRouter.csproj
index a17a6f3..ec80963 100644
--- a/MeshCentralRouter.csproj
+++ b/MeshCentralRouter.csproj
@@ -130,6 +130,7 @@
FileViewer.cs
+
Form
diff --git a/Program.cs b/Program.cs
index 77fbb4e..b5d11f2 100644
--- a/Program.cs
+++ b/Program.cs
@@ -22,13 +22,13 @@ namespace MeshCentralRouter
{
static class Program
{
- public static KVMControlHook controlHook = new KVMControlHook();
///
/// The main entry point for the application.
///
[STAThread]
static void Main(string[] args)
{
+
// Setup settings & visual style
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
diff --git a/Settings.cs b/Settings.cs
new file mode 100644
index 0000000..c93ea57
--- /dev/null
+++ b/Settings.cs
@@ -0,0 +1,41 @@
+using Microsoft.Win32;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace MeshCentralRouter
+{
+ public static class Settings
+ {
+ public static void SetRegValue(string name, string value)
+ {
+ try { Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value); } catch (Exception) { }
+ }
+ public static void SetRegValue(string name, bool value)
+ {
+ try { Registry.SetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value.ToString()); } catch (Exception) { }
+ }
+ ///
+ /// This function querys the registry. If the key is found it returns the value as a string
+ ///
+ /// Keyname
+ /// Return on fail
+ ///
+ public static string GetRegValue(string name, string value)
+ {
+ try { return Registry.GetValue(@"HKEY_CURRENT_USER\SOFTWARE\Open Source\MeshCentral Router", name, value).ToString(); } catch (Exception) { return value; }
+ }
+ ///
+ /// This function querys the registry. If the key is found it returns the value as a boolean
+ ///
+ /// Keyname
+ /// Return on fail
+ ///
+ public static bool GetRegValue(string name, bool value)
+ {
+ try { return bool.Parse(GetRegValue(name, value.ToString())); } catch (Exception) { return value; }
+ }
+ }
+}
diff --git a/SettingsForm.Designer.cs b/SettingsForm.Designer.cs
index d6e3a7a..41db19a 100644
--- a/SettingsForm.Designer.cs
+++ b/SettingsForm.Designer.cs
@@ -34,6 +34,9 @@
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.systemTrayCheckBox = new System.Windows.Forms.CheckBox();
this.allInterfacesCheckBox = new System.Windows.Forms.CheckBox();
+ this.exp_KeyboardHookCheckBox = new System.Windows.Forms.CheckBox();
+ this.exp_KeyboardHookPriorityCheckBox = new System.Windows.Forms.CheckBox();
+ this.label1 = new System.Windows.Forms.Label();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
@@ -55,6 +58,9 @@
// groupBox1
//
resources.ApplyResources(this.groupBox1, "groupBox1");
+ this.groupBox1.Controls.Add(this.label1);
+ this.groupBox1.Controls.Add(this.exp_KeyboardHookPriorityCheckBox);
+ this.groupBox1.Controls.Add(this.exp_KeyboardHookCheckBox);
this.groupBox1.Controls.Add(this.systemTrayCheckBox);
this.groupBox1.Controls.Add(this.allInterfacesCheckBox);
this.groupBox1.Name = "groupBox1";
@@ -72,6 +78,24 @@
this.allInterfacesCheckBox.Name = "allInterfacesCheckBox";
this.allInterfacesCheckBox.UseVisualStyleBackColor = true;
//
+ // exp_KeyboardHookCheckBox
+ //
+ resources.ApplyResources(this.exp_KeyboardHookCheckBox, "exp_KeyboardHookCheckBox");
+ this.exp_KeyboardHookCheckBox.Name = "exp_KeyboardHookCheckBox";
+ this.exp_KeyboardHookCheckBox.UseVisualStyleBackColor = true;
+ this.exp_KeyboardHookCheckBox.CheckedChanged += new System.EventHandler(this.exp_KeyboardHookCheckBox_CheckedChanged);
+ //
+ // exp_KeyboardHookPriorityCheckBox
+ //
+ resources.ApplyResources(this.exp_KeyboardHookPriorityCheckBox, "exp_KeyboardHookPriorityCheckBox");
+ this.exp_KeyboardHookPriorityCheckBox.Name = "exp_KeyboardHookPriorityCheckBox";
+ this.exp_KeyboardHookPriorityCheckBox.UseVisualStyleBackColor = true;
+ //
+ // label1
+ //
+ resources.ApplyResources(this.label1, "label1");
+ this.label1.Name = "label1";
+ //
// SettingsForm
//
this.AcceptButton = this.okButton;
@@ -98,5 +122,8 @@
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox systemTrayCheckBox;
private System.Windows.Forms.CheckBox allInterfacesCheckBox;
+ private System.Windows.Forms.CheckBox exp_KeyboardHookCheckBox;
+ private System.Windows.Forms.Label label1;
+ private System.Windows.Forms.CheckBox exp_KeyboardHookPriorityCheckBox;
}
}
\ No newline at end of file
diff --git a/SettingsForm.cs b/SettingsForm.cs
index 8892942..144cb51 100644
--- a/SettingsForm.cs
+++ b/SettingsForm.cs
@@ -28,6 +28,25 @@ namespace MeshCentralRouter
set { systemTrayCheckBox.Checked = value; }
}
+ public bool Exp_KeyboardHook
+ {
+ get { return exp_KeyboardHookCheckBox.Checked; }
+ set {
+ exp_KeyboardHookCheckBox.Checked = value;
+ if (!value)
+ {
+ exp_KeyboardHookPriorityCheckBox.Checked = false;
+ exp_KeyboardHookPriorityCheckBox.Enabled = false;
+ }
+ }
+ }
+
+ public bool Exp_KeyboardHookPriority
+ {
+ get { return exp_KeyboardHookPriorityCheckBox.Checked; }
+ set { exp_KeyboardHookPriorityCheckBox.Checked = value; }
+ }
+
private void okButton_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.OK;
@@ -37,5 +56,17 @@ namespace MeshCentralRouter
{
DialogResult = DialogResult.Cancel;
}
+
+ private void exp_KeyboardHookCheckBox_CheckedChanged(object sender, EventArgs e)
+ {
+ if (exp_KeyboardHookCheckBox.Checked)
+ {
+ exp_KeyboardHookPriorityCheckBox.Enabled = true;
+ } else
+ {
+ exp_KeyboardHookPriorityCheckBox.Checked = false;
+ exp_KeyboardHookPriorityCheckBox.Enabled = false;
+ }
+ }
}
}
diff --git a/SettingsForm.resx b/SettingsForm.resx
index 5a85133..13169c1 100644
--- a/SettingsForm.resx
+++ b/SettingsForm.resx
@@ -123,7 +123,7 @@
- 231, 94
+ 231, 266
75, 23
@@ -151,7 +151,7 @@
Bottom, Right
- 150, 94
+ 150, 266
75, 23
@@ -177,53 +177,102 @@
Top, Bottom, Left, Right
-
- systemTrayCheckBox
+
+ True
-
- System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+ NoControl
-
+
+ 10, 139
+
+
+ 196, 13
+
+
+ 4
+
+
+ Experimental Features (Use at own risk!)
+
+
+ label1
+
+
+ System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
groupBox1
-
+
0
-
- allInterfacesCheckBox
+
+ True
-
+
+ NoControl
+
+
+ 13, 155
+
+
+ 244, 69
+
+
+ 3
+
+
+ Override all default keyboard input with
+the keyboard hook in remote desktop
+(This is not considered stable use at own risk)
+This will allow for all key combinations execept
+CTRL + ALT + DEL
+
+
+
+ exp_KeyboardHookPriorityCheckBox
+
+
System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
+
groupBox1
-
+
1
-
- 12, 12
+
+ True
-
- 294, 76
+
+ NoControl
-
+
+ 13, 68
+
+
+ 210, 43
+
+
2
-
- Settings
+
+ Enable experimental keyboard hook
+(This may make some antiviruses mad!)
+This will allow special keys
-
+
+ exp_KeyboardHookCheckBox
+
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
groupBox1
-
- System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
-
-
- $this
-
-
- 0
+
+ 2
True
@@ -250,7 +299,7 @@
groupBox1
- 0
+ 3
True
@@ -277,7 +326,31 @@
groupBox1
- 1
+ 4
+
+
+ 12, 12
+
+
+ 294, 248
+
+
+ 2
+
+
+ Settings
+
+
+ groupBox1
+
+
+ System.Windows.Forms.GroupBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ $this
+
+
+ 0
True
@@ -286,7 +359,7 @@
6, 13
- 318, 129
+ 318, 301