Example Code

Devcon Device Control Using LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview
This code makes use of microsoft DevCon to allow the enabling, disabling and restarting of devices.


Description
This application finds all hardware according to DevCon and lists them in a listbox, you can then select hardware items and perform the given actions on them if the system allows it. You need to make sure you are running the application as an administrator to perform actions on hardware. If you are running the VI in the development environment, run the development environmen as an administrator.

 
Requirements

  • LabVIEW 2013 (or compatible)


Steps to Implement or Execute Code

  1. Open the project file (making sure you have already run LabVIEW as admin)
  2. Either run the toolkit.vi or build the application.
  3. (Optional) If you built the application, right click on it in the project and click run
  4. The hardware list will populate on the left hand side, this will allow you to select the hardware on your PC
  5. select actions on the right hand side, you can either enable, disable or restart hardware, similar to device manager.

 

Additional Information or References

VI Snippet of Block Diagram

BD.png

 

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

Matt H
Applications Engineer
National Instruments UK

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
InspiredTech
Member
Member
on

Hi MHutch,

Could you please post a screen shot on how devcon is impletemend in your code? I really appreciate you posting Devconmini, but cannot open the LabVIEW Project File in 2012.

Thank you!

MHutch
NI Employee (retired)
on

Hi InspiredTech,

Following your comment I uploaded a 2010 version of the code that you should be able to open. It is untested, but I can't see any reason why it wont function the same.

Kind regards,

Matt

Matt H
Applications Engineer
National Instruments UK
InspiredTech
Member
Member
on

Thank you, Matt

In case anyone has any questions about the line utility functions for devcon, here is another NI post concerning this same topic:

https://decibel.ni.com/content/docs/DOC-5165/diff?secondVersionNumber=3

Very cool UI's by the way. Are you a member of the UI interest group?

https://decibel.ni.com/content/groups/ui

MHutch
NI Employee (retired)
on

Thanks InspiredTech,

In my haste it looks like I didnt include everything neccessary with the 2010 version, but I should have rectified that now - Managed to find some time at the end of the day!

I can't seem to access that first link you posted, but I shall certainly look at the UI group! Thanks!

Kind regards,

Matt

Matt H
Applications Engineer
National Instruments UK
avictor
Member
Member
on

Hi All,

Could someone downgrade this project to LV2010?

Much appriciated!

Andrew

dlong
Member
Member
on

Hi MHutch,

It appears that when you fixed things on March 20 the project was saved as something newer than LV2011. When I attempt to open it with 2011SP1  I get a "LabVIEW: file version is later than the current LabVIEW version" error   I know the post is getting a bit old but I would really appreciate a new build for 2010 (that way Price could be in good shape too )

Thanks,

Dave