From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
06-12-2014 11:36 PM
Hi
I need to know if LabVIEW is in focus. Not just a single window but all windows contained in an .exe or the development environment.
Using the user32.dll:GetForegroundWindow is not an option as it returns any window handle id.
Any god ideas
Thanks
06-13-2014 01:30 PM
Hey there are those that would say I'm at my best when giving "god" answers, but be that as it may....
The user32.dll:GetForegroundWindow call returns a reference to whatever window is on top, but given that reference can't you find out the name of the process that owns it? I found this code on stackoverflow that illustrates several calls.
Mike...
06-13-2014 04:18 PM
06-13-2014 05:42 PM
06-16-2014 06:24 AM
Hi Kahr.
I have made a small example, that also uses the user32.dll:GetForegroundWindow function. I simply record the original handle, and then compare that with the current handle.
If you have multiple windows, I believe you can extend this idea, and simple record the new window handle and then have two compares.
Can you use this example?