LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable or enable (Connect or Disconnect )Wireless HID mouse connected computer in LabVIEW?

I am using a wireless mouse of logitech. it is connected to my laptop through usb dongle. it is a HID, I want to connect and Disconnect it using labview.

0 Kudos
Message 1 of 33
(1,135 Views)

I don't have a straight answer but general guidance for approaching such problems.

 

  1. Think how you would do such a thing manually (like going into Device Manager and disabling device driver etc.,)
  2. Search online on how to do that process in #1 using some way like dll, Windows Registry, PowerShell etc.,
  3. Next, find out how to implement #2 in LabVIEW.

#1 and #2 are the same irrespective of any programming language, whether C, C++, Python, C#, LabVIEW, MATLAB etc., this is because these are programming languages and they do not need to do the functionalities of an OS, some might have an easy way to control some OS functionalities (provided the OS has a way) and many don't.

 

This should help you for some time until you get a more concrete answer from fellow users.

Santhosh
Soliton Technologies

New to the forum? Please read community guidelines and how to ask smart questions

Only two ways to appreciate someone who spent their free time to reply/answer your question - give them Kudos or mark their reply as the answer/solution.

Finding it hard to source NI hardware? Try NI Trading Post
0 Kudos
Message 2 of 33
(1,095 Views)

The likely most easy way to do ths is to call devcon.exe through SystemExec in LabVIEW.

 

https://docs.microsoft.com/en-us/windows-hardware/drivers/devtest/devcon

 

Devcon is an utility that lets you do pretty much everything that you can also do in the device manager through the command line interface.

Rolf Kalbermatter
My Blog
0 Kudos
Message 4 of 33
(1,066 Views)

Hi Rolf,

 

Thank you for your help and replying me.

To use DEVCON I need to have WDK and visual studio.

Could u please suggest a solution which uses the DLL file and its function to do the same in LABVIEW.

 

Thank You

0 Kudos
Message 5 of 33
(1,039 Views)

Hi Kartik,

 

Thank you for replying me

Kartik, Blockinput function will block my all inputs. I want only a particular mouse to block in LABVIEW.

 

Thank You

0 Kudos
Message 6 of 33
(1,038 Views)

@SatishKV wrote:

To use DEVCON I need to have WDK and visual studio.

Could u please suggest a solution which uses the DLL file and its function to do the same in LABVIEW.

 

Thank You


You do not need the WDK to use the device console, it is just used to download the executable. You may even come across people offering the devcon.exe by itself. It is also recommended to use pnputil instead of devcon https://docs.microsoft.com/de-de/windows-hardware/drivers/devtest/pnputil (I have not tried pnputil myself).

0 Kudos
Message 7 of 33
(1,027 Views)

@SatishKV wrote:

 

Thank you for your help and replying me.

To use DEVCON I need to have WDK and visual studio.

Could u please suggest a solution which uses the DLL file and its function to do the same in LABVIEW.


I could in theory but in practice the Windows SetupAPI that is needed to get at the device handle to do some operations on a device is rather complex and uses pretty nasty data structure and sometimes even callbacks, so that calling them from LabVIEW is a very involved task. I don't have days of time over to research which APIs need to be called exactly and walk you through trying to call these APIs,

 

If you want to follow this path, you would have to download the WDK and/or checkout the source of this sample in the Microsoft github page and start writing those VIs yourself. But unless you have a really good understanding about C programming and some knowledge about how a C compiler actually works, it's going to be a long and painful experience.

 

Besides the WDK download should contain a build executable already, so the Visual Studio Installation should not be needed, strictly speaking. Downloading executables from 3rd party sites is something I would not recommend. You can never really be sure, what they really contain, many of them are nowadays tainted with built in code you rather would not want to have on your computer.

 

So unless you download code from a reputable side it's basically a poker game if you open up your computer to nastyness.

Rolf Kalbermatter
My Blog
0 Kudos
Message 8 of 33
(1,021 Views)

Hi,

 

This seemed like an appropriate thread to ask a question regarding LabVIEW & DevCon. I ( like the OP) needed a way to disable / enable a troublesome USB power supply, & BLED112 Bluetooth dongle before each instance of a LabVIEW test. I had successfully integrated some example code I found into my own application, and it worked flawlessly for several months.

 

This week my coworker & I have discovered that the DevCon commands being fed into SysExec are now getting an Exit Code of 1, with an error saying that the system has to be rebooted in order for the DevCon Restart to execute!

 

We are thinking that something may have caused the code to break, possible a Windows 10 or other update such as Kapersky or other security software IT uses?

 

Has anyone else experienced similar problems with previously working DevCon commands run in LabVIEW? We are using LabVIEW 2021 Full Dev, Version. My VI with the DevCon commands inside is attached.

 

Thanks for any help / advice / thoughts on why this is happening.

 

George

0 Kudos
Message 9 of 33
(940 Views)

Stupid question: Did you restart your system?

 

I recently had the case that a program complained that I needed to restart the computer in order to continue. Turned out Windows Update had silently installed some update that required a reboot and apparently this program was somehow blocked from doing what it wanted to do until I had restarted the computer.

Rolf Kalbermatter
My Blog
0 Kudos
Message 10 of 33
(926 Views)