none
how we can show message in app. when USB is connected mean show in app. that USB is connected and how many USB attach at a time RRS feed

  • Question

  •  private void button1_Click(object sender, EventArgs e)
            {
                const string path = @"system\currentcontrolset\services\usbstor";
                try
                {
                    using (RegistryKey rKey1 = Registry.LocalMachine.CreateSubKey(path))
                    {
    
    
                        rKey1.SetValue("start",
                            Convert.ToInt32("4", 16), RegistryValueKind.DWord);
                        rKey1.Close();
                        listBox1.Items.Add("USB Drive :\\ Block");
                        listBox1.Items.Add("On " + currentDay);
                        listBox1.Items.Add("");
                        save();
                        MessageBox.Show("DRive", "DRive LOcked", MessageBoxButtons.OK, MessageBoxIcon.Information);
    
                    }
    }

    Friday, August 15, 2014 12:38 PM

Answers

  • look at the toaster sample, enum project, to see how to enumerate existing instances. Also look at RegisterDeviceNotification which tells you about new instances arriving and old ones leaving

    d -- This posting is provided "AS IS" with no warranties, and confers no rights.

    Saturday, August 16, 2014 6:13 PM