none
List devices RRS feed

  • Question

  • What I want is to list the device administrator devices (Windows 7 ultimate 32 bit), show their names, icons, subitems, in a TreeView1.
    When clicking on a treeview node (item), I visualize its properties in a listview control.
    For example, as in the following image:

    I searched the internet like crazy and did not find any clear example in this language, that is why I come to you friends.

    I hope you can help me.
    Thank you

    Saturday, December 23, 2017 6:39 PM

Answers

  • Here is a base to start with, be forewarned it's old, it does not have everything.

    https://www.codeproject.com/Articles/51477/How-to-Get-a-List-of-Non-Working-Devices-Using-VB

    This is where Google is your friend, from there it's bits and pieces most likely along with not constraining to just VB.NET but also look at C# solutions. 

    https://www.google.com/search?q=vb.net+list+devices&oq=vb.net+list+deviv&aqs=chrome.1.69i57j0l5.8550j0j4&sourceid=chrome&ie=UTF-8


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:45 AM
    Saturday, December 23, 2017 7:32 PM
    Moderator
  •  There is a LOT more to doing that than you may think.  This is why you did not find a quick easy example for this on the internet.  I have written an app to do similar to this and i would not share all my hard work and research with everyone for free either.  I.m sure you will think the same thing after digging into all this for a few weeks.

     You can start by using the SetupDiGetClassDevs function to get an information set for all the devices,  then you can use the SetupDiEnumDeviceInfo function to iterate through all the devices.  As you iterate through them you can use the SetupDiGetDevicePropertyKeys function to get all the supported properties in the form of and array of DEVPROPKEY structures.  Then you can iterate through those and use the SetupDiGetDeviceProperty function to get the property values.  You will need to check the types of those values so you know how to convert the byte array (value) into the proper type such as a Uinteger,  Date,  List,  String,  and so on....

     However,  this is just a short explanation which leaves out a lot that you will need to learn and understand before getting any of those steps to work.  It will also require a very good understanding of creating and using managed vb.net signatures of the native functions and structures because,  you will probably not find the Vb.Net signatures for a majority of them on the internet.  I know i didn't.

     You may also be able to use WMI with some of the Computer System Hardware Classes to get some of the info you want but,  i find that it does not always get all the information that can be retrieved with the Setupapi Methods And Structures.


    If you say it can`t be done then i`ll try it

    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:45 AM
    • Edited by IronRazerz Monday, December 25, 2017 9:24 PM Updated the steps involved to show more
    Saturday, December 23, 2017 7:39 PM
  • Download this tool and try it. Be aware it is not about Surface, Microsoft seems to make its Ads currently 10 times larger than the information. 

    https://www.microsoft.com/en-us/download/details.aspx?id=8572


    Success<br/> Cor

    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:46 AM
    • Unmarked as answer by JenCarlos Sunday, December 24, 2017 3:47 AM
    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:47 AM
    • Unmarked as answer by JenCarlos Sunday, December 24, 2017 3:48 AM
    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:48 AM
    Saturday, December 23, 2017 9:17 PM

All replies

  • Hi

    ........ and your code so far is .............?


    Regards Les, Livingston, Scotland

    Saturday, December 23, 2017 6:45 PM
  • Here is a base to start with, be forewarned it's old, it does not have everything.

    https://www.codeproject.com/Articles/51477/How-to-Get-a-List-of-Non-Working-Devices-Using-VB

    This is where Google is your friend, from there it's bits and pieces most likely along with not constraining to just VB.NET but also look at C# solutions. 

    https://www.google.com/search?q=vb.net+list+devices&oq=vb.net+list+deviv&aqs=chrome.1.69i57j0l5.8550j0j4&sourceid=chrome&ie=UTF-8


    Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
    VB Forums - moderator
    profile for Karen Payne on Stack Exchange, a network of free, community-driven Q&A sites

    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:45 AM
    Saturday, December 23, 2017 7:32 PM
    Moderator
  •  There is a LOT more to doing that than you may think.  This is why you did not find a quick easy example for this on the internet.  I have written an app to do similar to this and i would not share all my hard work and research with everyone for free either.  I.m sure you will think the same thing after digging into all this for a few weeks.

     You can start by using the SetupDiGetClassDevs function to get an information set for all the devices,  then you can use the SetupDiEnumDeviceInfo function to iterate through all the devices.  As you iterate through them you can use the SetupDiGetDevicePropertyKeys function to get all the supported properties in the form of and array of DEVPROPKEY structures.  Then you can iterate through those and use the SetupDiGetDeviceProperty function to get the property values.  You will need to check the types of those values so you know how to convert the byte array (value) into the proper type such as a Uinteger,  Date,  List,  String,  and so on....

     However,  this is just a short explanation which leaves out a lot that you will need to learn and understand before getting any of those steps to work.  It will also require a very good understanding of creating and using managed vb.net signatures of the native functions and structures because,  you will probably not find the Vb.Net signatures for a majority of them on the internet.  I know i didn't.

     You may also be able to use WMI with some of the Computer System Hardware Classes to get some of the info you want but,  i find that it does not always get all the information that can be retrieved with the Setupapi Methods And Structures.


    If you say it can`t be done then i`ll try it

    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:45 AM
    • Edited by IronRazerz Monday, December 25, 2017 9:24 PM Updated the steps involved to show more
    Saturday, December 23, 2017 7:39 PM
  • Download this tool and try it. Be aware it is not about Surface, Microsoft seems to make its Ads currently 10 times larger than the information. 

    https://www.microsoft.com/en-us/download/details.aspx?id=8572


    Success<br/> Cor

    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:46 AM
    • Unmarked as answer by JenCarlos Sunday, December 24, 2017 3:47 AM
    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:47 AM
    • Unmarked as answer by JenCarlos Sunday, December 24, 2017 3:48 AM
    • Marked as answer by JenCarlos Sunday, December 24, 2017 3:48 AM
    Saturday, December 23, 2017 9:17 PM
  • If you are looking for sample code that does all of that in the same sample then you don't need to write the program yourself.

    The work of getting the data and then the code to put it into a UI are totally different. You should not ask anyone to do all of it in one question unless you post it to a site where you are offering to pay for it. What you should do is to search for answers to the question of how to "list" or "enumerate" devices. I have no idea what "device administrator devices" are but if you can find generalized samples of how to list devices then you can investigate how to filter them if relevant.

    Then a totally separate question is how to create a tree view. You can use samples are articles about that and it does not have to be for devices. And don't forget the documentation.

    Then you, as the developer, simply combine all that together and mix it up.



    Sam Hobbs
    SimpleSamples.Info

    Sunday, December 24, 2017 1:54 AM