10-13-2017 07:22 AM
10-16-2017 05:09 AM
I have found the process that starts/gets listed in "Device Manager" when the UPS starts/kicks in.
The name of the process is: "wlrmdr.exe"
So now I should be able to use "Call Library Function" set to path: "DevMgr.dll" and detect this process when it starts/gets listed !
But what function/parameters should I use for detecting(true/false) this process when it starts/gets listed in Device Manager?
10-16-2017 06:02 AM - edited 10-16-2017 06:03 AM
https://forums.ni.com/t5/LabVIEW/Is-there-a-way-to-see-if-a-process-is-running-in-Windows-Task/td-p/...@Avanti wrote:
So now I should be able to use "Call Library Function" set to path: "DevMgr.dll" and detect this process when it starts/gets listed !
But what function/parameters should I use for detecting(true/false) this process when it starts/gets listed in Device Manager?
Nooo. Calling a functions is not the way to check if the process is started! Calling a function will actually start a new process, and also you don't want to call a function!
See for instance this thread:
or follow the "process" link in my previous reply.
10-16-2017 07:55 AM
Nooo?
In the VI Library "winevent.llb" (API Function Utilities) they use "Call Library Function" -> "LVGetWindows" to show the running processes.
This works fine, but unfortunatly it only shows the "Windows" open, and not the entire process list (detailed) as I need...
But back to the .Net method I found an example that also works, but this also does not list everything (detailed list) as I need.
Can this .NET be adjusted for showing detailed list (see attached VI)?
10-16-2017 08:10 AM
You can use a API (Call Library Node)... I thought you where going to call a function in the process (Win...exe) which is not a good idea. But calling a windows function that detect the process by it's path might work.
The .net VI will also work. You should be able to use the function GetProcessByName instead of GetProcesses and loop through them all. The only problem could be you might need administrator rights to see some processes. The VI doesn't close references, but you should close them all.
10-17-2017 02:35 AM - edited 10-17-2017 02:38 AM
Allright!
I have now created a .NET VI that works as intended (see attached VI).
Note that the "processName", in this case a constant, can be changed to detect whatever process that is running (in Device Manager)
(Ps: Just remember to spell correctly with uppercase/lowercase letters, due to the "Equal" function).
10-17-2017 03:00 AM
If the process is there, you'll get a one element array, if not it's empty. Maybe you can just test if the resulting array is empty or not? Not sure if that is reliable enough, but the test would be redundant then.
The case sensitivity is typically avoided by converting both strings to either upper or lower case.
And while you're making these little building blocks, try to start with 4X4X4 connector pane, with proper error in\error out. You might already know that, but it's kinda important to do that from the start. Else you'll end up with 100 crappysub-optimal VI's and you'll never change them all afterwards.
10-17-2017 05:05 AM - edited 10-17-2017 05:07 AM
I have replaced "Equal" with a "Empty String/Path?" function !
In this case I chose to only make 1 connector to the VI, but the default (for my part) is normally 4x4x4 connector pane.
But I changed it to a 4x4x4 in the new VI.
10-17-2017 05:36 AM
Still, if you get a result, the array has 1 element. So you can ditch the for loop altogether, and use Empty Array to check if there are results or not. You're now using Empty String, but you might as well use a true constant. If the loop iterates once, the output is true, if not, the output is false...
10-17-2017 06:00 AM - edited 10-17-2017 06:00 AM
Okay
Final version (without For Loop)!