LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How do you make your application window frontmost?

Cross-Posted to LAVA

 

I need to programmatically force my LabVIEW application to become frontmost on a Windows system. Basically I want it to punch through any currently open application windows and become the main active app.
What I've tried:

 

  • I ran the SetForegroundWindow Windows API function. This causes the titlebar to flash and draw attention for a short while but does not make it frontmost.
  • I ran the BringWindowToTop Windows API function. This does not make it frontmost.
  • I made my application window floating. This does appear to work. However this causes other problems since the window which I need to be frontmost is also a dialog box. So I don't want the user to click behind the dialog box onto my main application window.
  • I tried using the floating window property (as mentioned above), then quickly made it modal again. This has the affect of flashing the window to the user and then disappearing behind any other app windows. Not good and also confusing.


So, is there any way to do this? 



Michael Aivaliotis
VI Shots LLC
0 Kudos
Message 1 of 5
(6,648 Views)

Mike, I'm trying to do the same thing, only I want to make a VI which is run via Call By Reference from a remote application instance always on top with key focus.  I can get always on top to work like you did in your cross-post, where I call SetWindowPos twice (once with hWndInsertAfter = -2 and again with it = -1).

 

Then, I get two "active" windows and the wrong one (launching application) has key focus.  SetFocus, SetActive, etc. seem to be no help whether I call them before or after SetWindowPos.  SetForegroundWindow just makes it blink 3 times, like you had experienced...

 

Any Ideas?

 

19445i6D4C3E9B9D022FE6

 

 


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 2 of 5
(6,610 Views)

See here for solution to my question.


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
0 Kudos
Message 3 of 5
(6,574 Views)

Ok that last link got mangled.  Here is the solution.


Certified LabVIEW Architect
TestScript: Free Python/LabVIEW Connector

One global to rule them all,
One double-click to find them,
One interface to bring them all
and in the panel bind them.
Message 4 of 5
(6,536 Views)