Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Enumerating hardware devices?

SephirothSephiroth Fayetteville, NC, USAPosts: 1,035Member
How does one go about this task in VB.NET? I am working on two projects at this point and need to figure out what devices of a set type are installed in the system in each program. One needs to discover all modems and network cards, and the other needs to find all CD/DVD drives and get their mounted letter, such as D:. How would I do this? I know there are methods to do so in C++, but these two applications are Win32/Win64 only, so I am using VB.NET fopr fast development.

-[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/green][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h[/red][/b][/italic]

Comments

  • BitByBit_ThorBitByBit_Thor Posts: 2,444Member
    : How does one go about this task in VB.NET? I am working on two
    : projects at this point and need to figure out what devices of a set
    : type are installed in the system in each program. One needs to
    : discover all modems and network cards, and the other needs to find
    : all CD/DVD drives and get their mounted letter, such as D:. How
    : would I do this? I know there are methods to do so in C++, but these
    : two applications are Win32/Win64 only, so I am using VB.NET fopr
    : fast development.
    : [link=null][/link]
    : -[italic][b][red]S[/red][purple]e[/purple][blue]p[/blue][green]h[/gre
    : en][red]i[/red][purple]r[/purple][blue]o[/blue][green]t[/green][red]h
    : [/red][/b][/italic]

    After much searching, I have deduced that you will need to use WMI for this. It uses a variation of SQL: WQL
    Here are the MSDN links I came accros:
    [link=http://msdn2.microsoft.com/en-us/library/ms186146.aspx]WMI Queries[/link]
    Then for the classes you can use in the WQL statements look at [link=http://msdn2.microsoft.com/en-us/library/aa389273.aspx]Computer System Hardware Classes[/link].

    EDIT: Another (useful?) link: [link=http://msdn2.microsoft.com/en-us/library/ms186146.aspx]WMI .NET implementation[/link]

    Accessing the the WMI information goes through the System.Management namespace.

    This could get really complicated - but I think I gave you a very nice first step: you now atleast know WHAT to look for - I spent around 45 minutes browsing the .NET framework classes and entering fruitless search queries in the .NET documentation :)

    Best Regards,
    Richard

    The way I see it... Well, it's all pretty blurry
  • VSCurtisVSCurtis Posts: 3Member
    Sounds to me like what you're trying to do is capute device manager information for any given pc. I'm working on a project in VB.Net that does this. It uses APIs to get the device classes, devices and related information for the device. I use a treeview and listviews to display the information. Once I have the information diplayed properly my plan is to write it to a series of tables using the computer name as a key. This will allow me to capture baseline configuration information for one or more computers, store it, and redisplay it at will. I'm also considering adding query capabilities to the tool. For now I have the treeview populated with device classes and devices and I have some of the device information being displayed. My device classes are not being displayed in the same order as device manager. Still trying to figure that one out, but I'm on my way.

    Is this what you're looking for?
  • VSCurtisVSCurtis Posts: 3Member
    Sounds to me like what you're trying to do is capute device manager information for any given pc. I'm working on a project in VB.Net that does this. It uses APIs to get the device classes, devices and related information for the device. I use a treeview and listviews to display the information. Once I have the information diplayed properly my plan is to write it to a series of tables using the computer name as a key. This will allow me to capture baseline configuration information for one or more computers, store it, and redisplay it at will. I'm also considering adding query capabilities to the tool. For now I have the treeview populated with device classes and devices and I have some of the device information being displayed. My device classes are not being displayed in the same order as device manager. Still trying to figure that one out, but I'm on my way.

    Is this what you're looking for?
  • VSCurtisVSCurtis Posts: 3Member
    Sounds to me like what you're trying to do is capute device manager information for any given pc. I'm working on a project in VB.Net that does this. It uses APIs to get the device classes, devices and related information for the device. I use a treeview and listviews to display the information. Once I have the information diplayed properly my plan is to write it to a series of tables using the computer name as a key. This will allow me to capture baseline configuration information for one or more computers, store it, and redisplay it at will. I'm also considering adding query capabilities to the tool. For now I have the treeview populated with device classes and devices and I have some of the device information being displayed. My device classes are not being displayed in the same order as device manager. Still trying to figure that one out, but I'm on my way.

    Is this what you're looking for?
Sign In or Register to comment.