private void Form1_Load(object sender, EventArgs e) { try { connectLock = "connect"; handleLock = "handle"; int usbstor_encryption = 0; RegistryKey mydlpKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\MyDLP\"); try { usbstor_encryption = (int)mydlpKey.GetValue("usbstor_encryption", 0); } catch { //todo } if (usbstor_encryption == 0) { //Application.Exit(); this.Dispose(); return; } listenVolumeThread = new Thread(ProcessNewVolumes); listenVolumeThread.Start(); notifyIcon1.Visible = true; this.Visible = false; formatDialog = new FormatDialog(); //formatDialog.Owner = this; aboutBox.Text = "MyDLP Endpoint Agent\r\nwww.mydlp.com"; } catch (Exception ex) { //MessageBox.Show(ex.Message + ex.StackTrace); this.Dispose(); return; //Unable to open registry nothing to do } }