LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detect "You're about to be signing out" using Call Library Function.

Solved!
Go to solution

If you feel like it's a solution, you can simply search for the Window (by name) or see if the process in "live". Then you'd really be checking if the message is shown. You'll need to continuously repeat that, making it a less ideal solution.

0 Kudos
Message 11 of 23
(638 Views)

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 Smiley Happy !

But what function/parameters should I use for detecting(true/false) this process when it starts/gets listed in Device Manager? Smiley Frustrated

0 Kudos
Message 12 of 23
(629 Views)

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 Smiley Happy !

But what function/parameters should I use for detecting(true/false) this process when it starts/gets listed in Device Manager? Smiley Frustrated


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:

https://forums.ni.com/t5/LabVIEW/Is-there-a-way-to-see-if-a-process-is-running-in-Windows-Task/td-p/...

 

or follow the "process" link in my previous reply.

0 Kudos
Message 13 of 23
(625 Views)

Nooo? Smiley Indifferent
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)?

 

0 Kudos
Message 14 of 23
(612 Views)

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.

0 Kudos
Message 15 of 23
(606 Views)

Allright! Smiley Happy
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) Smiley Happy
(Ps: Just remember to spell correctly with uppercase/lowercase letters, due to the "Equal" function).

 

 

0 Kudos
Message 16 of 23
(599 Views)

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.

0 Kudos
Message 17 of 23
(591 Views)

I have replaced "Equal" with a "Empty String/Path?" function Smiley Wink !

In this case I chose to only make 1 connector to the VI, but the default (for my part) is normally 4x4x4 connector pane. Smiley Very Happy
But I changed it to a 4x4x4 in the new VI.

0 Kudos
Message 18 of 23
(583 Views)

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...

0 Kudos
Message 19 of 23
(577 Views)

Okay Smiley Wink

Final version (without For Loop)!

0 Kudos
Message 20 of 23
(571 Views)