コード例 #1
0
        void EnumEhStorDevices()
        {
            try
            {
                PortableDeviceManagerImp manager = new PortableDeviceManagerImp();
                Console.WriteLine("{0} Windows Portable Device(s) found in the system", manager.deviceCount);

                for (Int32 n = 0; n < manager.deviceCount; n++)
                {
                    Console.WriteLine("[" + n.ToString() + "]" +
                                    "\n\tManufacturer:     " + manager.deviceManufacturer(n) +
                                    "\n\tDescription:      " + manager.deviceDescription(n) +
                                    "\n\tFriendly Name:    " + manager.deviceFriendlyName(n) +
                                    "\n\tPNP ID:           " + manager.deviceID(n));
                }
            }
            catch (COMException exception)
            {
                Console.WriteLine("COM exception: code {1}, {0}", exception.Message, exception.ErrorCode);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }
コード例 #2
0
        void EnumEhStorDevices()
        {
            try
            {
                PortableDeviceManagerImp manager = new PortableDeviceManagerImp();
                Console.WriteLine("{0} Windows Portable Device(s) found in the system", manager.deviceCount);

                for (Int32 n = 0; n < manager.deviceCount; n++)
                {
                    Console.WriteLine("[" + n.ToString() + "]" +
                                      "\n\tManufacturer:     " + manager.deviceManufacturer(n) +
                                      "\n\tDescription:      " + manager.deviceDescription(n) +
                                      "\n\tFriendly Name:    " + manager.deviceFriendlyName(n) +
                                      "\n\tPNP ID:           " + manager.deviceID(n));
                }
            }
            catch (COMException exception)
            {
                Console.WriteLine("COM exception: code {1}, {0}", exception.Message, exception.ErrorCode);
            }
            catch (Exception exception)
            {
                Console.WriteLine(exception.Message);
            }
        }