-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsForm.cs
More file actions
33 lines (28 loc) · 1.03 KB
/
Copy pathSettingsForm.cs
File metadata and controls
33 lines (28 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using Microsoft.Win32;
namespace QwertyToMIDI
{
public partial class SettingsForm : Form
{
public SettingsForm()
{
InitializeComponent();
}
private void SettingsForm_Load(object sender, EventArgs e)
{
RegistryKey winLogonKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
checkBox_Startup.Checked = winLogonKey.GetValueNames().Contains(Application.ProductName);
}
private void checkBox_Startup_CheckedChanged(object sender, EventArgs e)
{
RegistryKey rk = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
if (checkBox_Startup.Checked)
rk.SetValue(Application.ProductName, Application.ExecutablePath);
else
rk.DeleteValue(Application.ProductName, false);
}
private void button_Ok_Click(object sender, EventArgs e)
{
Close();
}
}
}