Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Discover a Device in C#

Discover a Device in C#

Scheduled Pinned Locked Moved C#
csharphelpquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Amjath Rahman
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • A Amjath Rahman

      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

      M Offline
      M Offline
      Martin 0
      wrote on last edited by
      #2

      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

      A 1 Reply Last reply
      0
      • M Martin 0

        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

        A Offline
        A Offline
        Amjath Rahman
        wrote on last edited by
        #3

        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

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups