LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I determine the task/application that a user is working on?

I am trying to write a labview program to run in the background and monitor the tasks/applications that are currently being used by the computer user. I am aware of Get Task List - but I was wondering if there was any way to know exactly the program that is being used at that time - not just the programs that are opened.

Thanks!
0 Kudos
Message 1 of 3
(2,601 Views)
I have a solution but it is not going to be pretty. First of all you need to download and install the windows api utilities. Goto the main NI page and in the search bar look for Windows API Function Utilities (32-bit) for LabVIEW. This will give you easy access to many windows functions. In particular it has a function for returning the window name which will be used.

Next you will need to open a new VI and place a call library node. Direct this node to system32\user32.dll and choose the function GetForegroundWindow . The msdn link for the function follows: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/WinUI/WindowsUserInterface/Windowing/Windows/WindowReference/WindowFunctions/GetForegroundWindow.asp

Set the return ty
pe to be a 32 bit integer. Return to LabVIEW, and place Rename Window.vi from the utilities on the diagram. Create a control for the window handle on Rename Window.vi--this will be used to cast the integer from the library node into a LabVIEW reference that can be passed into Rename Window. To be clear the control you created will only be connected to the casting function. Lastly wire up a string indicator on Rename Window.vi. You can add bells and whistles but this will get you going.

I have attached a VI to fill in the gaps I left out of the description. Remember to get the Windows Utilities.
0 Kudos
Message 2 of 3
(2,601 Views)
Thank you very much for your help - your suggestions work perfectly. I really appreciate your time.

Thanks!
0 Kudos
Message 3 of 3
(2,601 Views)