JDave Posted March 6, 2008 Report Share Posted March 6, 2008 How can I determine if LabVIEW is the active (frontmost) application? I know that you can set a VI to be floating and automatically hide when LabVIEW is not active. But is there any way to access that information via an event or property node? If I had a floating VI, I could check if it was hidden or not -- but to make it interesting let us assume that is not an option. On a side note, I tried the scripting event for "Application Activation" but I couldn't even determine what event causes this to fire. David Quote Link to comment
Tim_S Posted March 6, 2008 Report Share Posted March 6, 2008 QUOTE(JDave @ Mar 5 2008, 03:41 PM) How can I determine if LabVIEW is the active (frontmost) application? I know that you can set a VI to be floating and automatically hide when LabVIEW is not active. But is there any way to access that information via an event or property node? If I had a floating VI, I could check if it was hidden or not -- but to make it interesting let us assume that is not an option.David In the user32.dll there is a SetWindowPos function that can be used to make the window the frontmost. I didn't see a get or query counterpart in a brief search, but that would be the place to look. Tim Quote Link to comment
TobyD Posted March 6, 2008 Report Share Posted March 6, 2008 QUOTE(JDave @ Mar 5 2008, 12:41 PM) How can I determine if LabVIEW is the active (frontmost) application? I know that you can set a VI to be floating and automatically hide when LabVIEW is not active. But is there any way to access that information via an event or property node? If I had a floating VI, I could check if it was hidden or not -- but to make it interesting let us assume that is not an option.On a side note, I tried the scripting event for "Application Activation" but I couldn't even determine what event causes this to fire. David Call GetActiveWindow or GetForegroundWindow from user32.dll. Pass the handle into GetWindowText if you want the windows name. http://msdn2.microsoft.com/en-us/library/m...292(VS.85).aspx Toby Quote Link to comment
bmoyer Posted March 7, 2008 Report Share Posted March 7, 2008 There's the VI property node FP.IsFrontmost that I've used to stop polling the serial port if the window is not on top. I'm not sure your application but this might work. Bruce Quote Link to comment
JDave Posted March 7, 2008 Author Report Share Posted March 7, 2008 QUOTE(TobyD @ Mar 5 2008, 03:50 PM) Call GetActiveWindow or GetForegroundWindow from user32.dll. Pass the handle into GetWindowText if you want the windows name.http://msdn2.microsoft.com/en-us/library/m...292(VS.85).aspx Toby Thanks. I was really hoping for a platform independent solution, but in talking to NI it appears that they also use the OS API to hide and unhide their floating windows. So this seems the way to go. Thanks again. David Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.