11-09-2009 01:59 PM
Hi, LVers,
My program requires two windows applications. One is labview VI panel, the other one is a non-labview application, for example, Windows Notepad.
I want to programabally deactivate the VI panel (either by minimizing it or keeping it unchanged) and activate the Notepad window. When the process in Notepad finish, the VI panel window is activated again and the Notepad window is deactivated.
Any suggestions? My LV is 8.5.
11-09-2009 02:51 PM
How the VI will know when the notepad operations have finished ?
When it is closed, or maybe when a key is pressed (like F12) ?
Search for "lvwutil32", for handling other windows applications
11-09-2009 02:56 PM - edited 11-09-2009 02:57 PM
Pnt wrote:How the VI will know when the notepad operations have finished ?
When it is closed, or maybe when a key is pressed (like F12) ?
Search for "lvwutil32", for handling other windows applications
(pssst... Sysexec >>> run notepad and wait for it to complete).
Ben
11-09-2009 03:03 PM
Sorry, I just use Notepad as a simplification.
Acutally my program use LabVIEW to control the LaVision high speed CCD. The CCD is drived by its own windows application DAVIS.
Meanwhile, DAVIS works as an DDE server though which my LV can access low-level command to customize CCD.
When the process in DAVIS start, I want DAVIS window to be activated and the LV is deactivated. When the precess at DAVIS finish, LV will be notified. Then DAVIS window will be deactivated and the LV panel gets activation again.
11-09-2009 04:10 PM
Hi, Pnt
Thanks for your reply.
I have tried your method as shown in the picture.
The VI is hiden as expected. However, the notepad window is not activated after the VI is hiden. The VI still holds the Activation although it is invisible.
11-10-2009 12:25 AM
The rest of your solution is Ben's post.
Use the System execution vi, to run Notepad (for example) with the option "Wait until completition" set to True.
When you close notepad , the vi will continue.
Then you will have to make the front panel visible again by changing the "hidden" option in my picture
11-10-2009 08:26 AM
Thanks Pnt.
Your suggestion is good but still can not meet my requirement.
I have two applications running together. One is VI panel and the other one is Notepad. They will be lunched manually and kept co-existing until being closed manually.
During labview execution, the VI panel and Notepad need to switch window activation between each other, means when the task at Notepad finishes, Notepad lost its activation (application is not closed, just wait) and the VI panel gets window activation. Then when the task at VI finishes (VI panel is not closed, just wait), VI lost window activation and the Notepad get back window activation again. So on and so forth.
Thanks.
11-10-2009 08:33 AM
mowr wrote:Thanks Pnt.
Your suggestion is good but still can not meet my requirement.
I have two applications running together. One is VI panel and the other one is Notepad. They will be lunched manually and kept co-existing until being closed manually.
During labview execution, the VI panel and Notepad need to switch window activation between each other, means when the task at Notepad finishes, Notepad lost its activation (application is not closed, just wait) and the VI panel gets window activation. Then when the task at VI finishes (VI panel is not closed, just wait), VI lost window activation and the Notepad get back window activation again. So on and so forth.
Thanks.
With that clarification I have to quote from Pnt's post #2 above "Search for "lvwutil32", for handling other windows applications" That set of utilities has been discussed many times on this forum (please search) and will let you monitor the states of apps running under Windoze.
Ben
11-10-2009 09:11 AM - edited 11-10-2009 09:19 AM
Why don't you have two seperate threads. One while loop that calls notepad and another that controls your front panel. Then use register events. When notepad is done, it registers an event that activates your front panel. When front panel is done, it activates an event that brings notepad back up. This is an incredibly sloppy example (1. I don't use register events much. 2. Time crunch.) However, maybe someone can expand on this or you can use it as a starting point.