LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

open front panel in back of other windows?

Hello,

I am running Labview 8.0 on Windows XP.  I have a VB program that calls a Labview vi to do a task, then that Laview vi closes itself when it is done.  This happens a few times per hour.

I would like the vi front panel to open when launched, but behind any other windows (other applications) that are in use.  Therefore, if a user is, say, analyzing data with Excel, she won't have a Labview window popping up every twenty minutes.  However, I don't want the vi to start minimized in the tray.  The reason for that is that if a user closes other applications, I want her to obviously see that the Labview vi is running (and see the data streaming in).

So is there a way to specify that the front panel open to its natural size, but behind any other windows already open?  I see in other threads how to have it come to the front and I know how to simply have it minimize or hide itself.

As an aside (tip), I have Windows run a small vi that simply hides itself and loops forever at startup.  Therefore, Labivew does not have to restart everytime the VB program calls the main vi to do its task (also avoids the "getting started" screen coming up each time the vi closes). Others may find this trick useful (or is it obsolete?).

Thanks for any advice,

ryan
0 Kudos
Message 1 of 7
(4,570 Views)
Have you tried the "Is Frontmost" property of the Front Panel? That should do what you want.

Message Edited by smercurio_fc on 09-24-2007 10:35 AM

0 Kudos
Message 2 of 7
(4,559 Views)
I have tried that, but it did not help.  Setting that property to True brings the window to the front, but setting it to false does not send the window to the back. I guess that the window is already to the front before the "false" is read.  This little vi that I just made to double check.

0 Kudos
Message 3 of 7
(4,546 Views)
You can use the FP.IsFrontmost property to bring the main window back to the front immediately after you open the "background" window. If you need an example I can throw one together and post it.
0 Kudos
Message 4 of 7
(4,532 Views)
TobyD: That sounds like it will do the trick.  The only thing I'm not sure how to do is how to get the "reference" of the "main" window to pass to FP.IsFrontmost.  In this case, the main window could be from any application, e.g. Excel.  So once the "background" vi pops up, I would need to get the reference to the main window, which is now the second window from the front (since it has just been superceded by the "background" window) and then use FP.IsFrontmost to bring it to the front. 

Do you know how to pass the reference for "whatever window is second from the front" to a property node?

Thanks
0 Kudos
Message 5 of 7
(4,531 Views)
For that you'll need to do some Windows API calls. If your VI is being called by VB, which I assume you mean the VB within Excel, then you need to get a pointer to the frontmost window using the GetForegroundWindow API call when your VI starts. Your VI then opens its front panel, which would automatically bring it to the front, and then it would bring the original frontmost window to the front. I don't think there's any way to prevent the VI's panel from being initially displayed since LabVIEW is controlling that. However, the original frontmost window should be returned to the front. Attached is an example, though I haven't tested it.

Also, since you're calling your VI from VB it would probably be better for you to compile the LabVIEW code into a DLL. Then, you don't need to load the entire development environment just to get your VI to run. You would only need the run-time engine. This would likely eliminate the need for that little VI that you have continuously running, which isn't that great a solution in the first place anyway.
Message 6 of 7
(4,517 Views)
That is just what I was working on saying. You beat me to it Smiley Tongue
0 Kudos
Message 7 of 7
(4,513 Views)