JasonBourne
JasonBourne

Reputation: 185

How to programmatically switch active windows in LabView

I am currently executing a third party software using the System Exec.vi from LabView. I need to send some keyboard input to this program, but it can't be through the standard input, but rather like Windows (i.e. if you click Alt+F4 the window closes, Alt+F goes to the File Menu, etc.). I already have a way of inserting this keyboard combinations into the program, but the problem I'm having is that as soon as I execute it with the System Exec, this program goes somehow to the background. This happens even when I have "run minimized" set to false, and regardless of the state of "wait until completion".

Since I can't figure out what is making the program window go to the background, what I need is to switch from the LabView window (which always remains active) to the program one. Does anyone know a way of doing this?

Thanks!

Upvotes: 2

Views: 3993

Answers (1)

PhilMasteG
PhilMasteG

Reputation: 3185

If you know the Name of the Window you'd like to activate, you could use FindWindowA and SetForegroundWindow of the Windows API user32.dll via "Call Library Function".
See http://digital.ni.com/public.nsf/allkb/B5F993B3C19521CB86256F1E00595E64

Upvotes: 1

Related Questions