Discover a Device in C#
-
Hi All, I want to find find all the device around my PC or Device, How can i do that i broadcast message, all client around for responding but not able to collect all the message plz help me to find the answer With Regards Amjath
-
Hi All, I want to find find all the device around my PC or Device, How can i do that i broadcast message, all client around for responding but not able to collect all the message plz help me to find the answer With Regards Amjath
Hello, In .Net < 2.0 you have to use System.Management functionalities.
ArrayList drives = new ArrayList(); using(ManagementObjectSearcher DriveSearch = new ManagementObjectSearcher(new SelectQuery("Select \* from Win32\_LogicalDisk"))) { using(ManagementObjectCollection moDriveCollection = DriveSearch.Get()) { foreach(ManagementObject mo in moDriveCollection) { LogicalDriveInfo driveinfo = new LogicalDriveInfo(mo); if(this\[driveinfo.Name\] == null) drives.Add(driveinfo); mo.Dispose(); } } }
For .Net >= 2.0 you could use DriveInfo.GetDrives()[^]
All the best, Martin
-
Hello, In .Net < 2.0 you have to use System.Management functionalities.
ArrayList drives = new ArrayList(); using(ManagementObjectSearcher DriveSearch = new ManagementObjectSearcher(new SelectQuery("Select \* from Win32\_LogicalDisk"))) { using(ManagementObjectCollection moDriveCollection = DriveSearch.Get()) { foreach(ManagementObject mo in moDriveCollection) { LogicalDriveInfo driveinfo = new LogicalDriveInfo(mo); if(this\[driveinfo.Name\] == null) drives.Add(driveinfo); mo.Dispose(); } } }
For .Net >= 2.0 you could use DriveInfo.GetDrives()[^]
All the best, Martin
Hi Martin, Thanks for ur valuable inputs. i will explain in detail wat i want, i have 1 details connected to my pc that device associate to many wireless clinet, i want get the information abt that wireless devices, how can i do that With Regards Amjath