06-04-2018 09:22 AM
Good day all,
I'm having the next issue:
I have in production floor PC that runs several applications: windows, LabVIEW and visual basic applications. I had to
developed an application using LabVIEW, but I require to run this app, first than the others. What I'm trying to do
is that, this application must be always on front, until operators is done using it. What I have tried up to now, is
using modal windows, programmatically been calling FRONTMOST = True. But even if I do this, operator can change
window between program, with just a click in the windows taskbar. Is there a way, to always put my desired LabVIEW application on top of every other window application that is open?
Solved! Go to Solution.
06-04-2018 10:47 AM
Use NI's Window API library to set a window to top most.
http://www.ni.com/example/29935/en/
A topmost window will be in the front of all normal windows even if it's not an active window.
06-04-2018 12:35 PM
Ok, I've just located the subVI that is located in this library, which it's named by: "Make Windows Always on Top". It has
three inputs: window refnum (NaWR), window name and activate? (F).
If I'm using a state machine, should I place this subVI in the first state?
How do I retrieve the windows refnum of my main labview window??
06-04-2018 12:49 PM
Take a look at this article. It is a little bit more clear than what was linked.
06-04-2018 01:33 PM
I just tested calling those two function the webpage mentions. Apparently it focuses only on other LabVIEW applications. It maintains your application with priority on top. But if for example windows explorer is open, you can place that window on top... Is there a way to even place LabVIEW application on top of every single application that is open, or might be open...
06-04-2018 02:21 PM
It did the job. But it was kind of weird. Because I practically had to do a copy of the subVI and paste it, into a folder. Because
if I dragged the subVI directly from the dialog box that appears from the library file and place in the block diagram, it won't work. It has to be by copy and pasting the subVI to a folder. Then from there just drag and place it to the block diagram. At least this
way it worked for me.
Many thanks man! I appreciate it.
06-04-2018 02:33 PM
window refnum is optional, if you don't have it, just use the window name.
You can call this VI outside the while loop. wire the error out to the loop to enforce data flow.
Use VI property to get front panel title.
06-04-2018 02:43 PM
@BowenM:
SetForegroundWindow can't keep a window on top of an active window. e.g. someone can click and bring another window on top of your window.