I'm activating an external .exe application through Labile.
When the application is activated a GUI is opened and I can automatically use this application properties.
The problem is, each time the user presses the screen, outside the GUI window, I lose the focus on this application and can't use its features any more.
1) How can I return the focus to this application window and keep on working with it after such a case ?
Otherwise, is it possible to disable the keyboard and/or mouse for a specific time (when the GUI is on) so the user won't accidentally press some buttons ?
2) How can I resize an application window to a specific size I choose ?
Thanks in advance!
Solved! Go to Solution.
When you say "How can I return the focus to this application window" to which window are you referring? Earlier you said "When the application is activated a GUI is opened and I can automatically use this application properties" so it seems that when you say "application you're referring to this "external" application. But, it (1) it seems that you're referring to your LabVIEW VI's window.
Also in (2) "How can I resize an application window to a specific size I choose ?", again, which application are you referring to?
In both cases I meant for the external application.
To better explain, lets say I activate an EXCEL application (for example), but each time the user presses a button on my LABVIEW GUI or just clicks the screen outside the Excel I lose the focus on the Excel application.
My thought was to set the focus on the external application every time I need to address it and also resize it so it won't disturb my Labview GUI which is running at the same time.
You would need to resort to operating system calls. If you're on Windows you can use the lvwutil32 library which contains many functions on window control. You can find the utilities here. If your version of LabVIEW is 8.5 or greater you will need to get them from here.
If you're not on Windows, then you would need to see what API is available for the operating system you're using.
I found the specific vi of the Resize function.
Regarding the focus: I still didn't find a specific vi that returns the focus to a selected window. It looks like I can use the Show window vi to return the focus but it only works after the Hide window vi was called before, which is not so convenient...
Do you know any specific vi for the focus function or is this the best solution I can use ?