jpo Posted August 28, 2007 Report Share Posted August 28, 2007 For debugging and testing purposes, I would like to be able to have my VI programmatically tell itself if it is running as a VI in the Labview development environment or if it is as a built application? Currently, I am using a simple case statement with boolean constant to control this feature. John Quote Link to comment
Dan Bookwalter Posted August 28, 2007 Report Share Posted August 28, 2007 QUOTE(jorourke @ Aug 27 2007, 02:42 PM) For debugging and testing purposes, I would like to be able to have my VI programmatically tell itself if it is running as a VI in the Labview development environment or if it is as a built application?Currently, I am using a simple case statement with boolean constant to control this feature. John John try using the Application Property "App.Kind" wire that to your case(s) Dan Quote Link to comment
Jim Kring Posted August 28, 2007 Report Share Posted August 28, 2007 QUOTE(jorourke @ Aug 27 2007, 11:42 AM) For debugging and testing purposes, I would like to be able to have my VI programmatically tell itself if it is running as a VI in the Labview development environment or if it is as a built application? Currently, I am using a simple case statement with boolean constant to control this feature. John The most reliable way is to read the Application.Kind property. If it equals "Run Time System" then you're in an EXE (running from the LabVIEW Run Time Engine). http://forums.lavag.org/index.php?act=attach&type=post&id=6775''>http://forums.lavag.org/index.php?act=attach&type=post&id=6775'>http://forums.lavag.org/index.php?act=attach&type=post&id=6775 Quote Link to comment
Eugen Graf Posted August 28, 2007 Report Share Posted August 28, 2007 Or you can use the property "BD Size" and compare it with 0. Eugen Quote Link to comment
jpdrolet Posted August 28, 2007 Report Share Posted August 28, 2007 QUOTE(Eugen Graf @ Aug 27 2007, 04:42 PM) Or you can use the property "BD Size" and compare it with 0.Eugen Does it work when a VI with its BD is run by an application? Quote Link to comment
Omar Mussa Posted August 29, 2007 Report Share Posted August 29, 2007 QUOTE(jpdrolet @ Aug 27 2007, 03:25 PM) Does it work when a VI with its BD is run by an application? Don't use this method, use the one Jim posted. A developer can strip a BD from a VI that is still in the development environment! (Either I didn't reply fast enough or Jim and I replied at same time...!) I reiterate what Jim says. Quote Link to comment
Jim Kring Posted August 29, 2007 Report Share Posted August 29, 2007 QUOTE(Eugen Graf @ Aug 27 2007, 01:42 PM) Or you can use the property "BD Size" and compare it with 0.Eugen This assumes that if a VI has no block diagram that it is built as an EXE. However, it is possible that the block diagram might be stripped and the code is running in the development environment. But, it is also possible that the code is running in the Run Time Engine and it has not been built as an EXE (so I'll admit that my solution is not fool-proof either). The only reliable way to tell if something is built is to perform some operation during the build process which only happens during the build process and check for that in the code. I use OpenG Builder to set Version Info (Version Number, Build Number, and Build Date) on a cluster of a VI's front panel (which is a fool proof-way to tell if the code is built). However, for the casual user, I believe that the check for App.Kind == Run Time System is the most reliable mechanism. Quote Link to comment
Eugen Graf Posted August 29, 2007 Report Share Posted August 29, 2007 All is right, what you wrote. It's only one alternative way to do it, but the MOST REALIBLE is to use App.Kind property. Eugen Quote Link to comment
jpo Posted August 29, 2007 Author Report Share Posted August 29, 2007 I tried out the comparision with App.Kind and it has worked successfully. Thanks, John Quote Link to comment
Yair Posted August 29, 2007 Report Share Posted August 29, 2007 QUOTE(Jim Kring @ Aug 28 2007, 08:33 AM) But, it is also possible that the code is running in the Run Time Engine and it has not been built as an EXE How? Are you thinking about dynamically calling VIs? The property is an Application class property, so it should return the kind of the application instance, not the specific VI which is executed (e.g. if you connect to a running EXE through VI server, you will get the development environment value if you use a local property node and you should get the RTE value if you use a reference to the remote app). Quote Link to comment
Jim Kring Posted August 29, 2007 Report Share Posted August 29, 2007 QUOTE(yen @ Aug 28 2007, 11:54 AM) How? Are you thinking about dynamically calling VIs?The property is an Application class property, so it should return the kind of the application instance, not the specific VI which is executed (e.g. if you connect to a running EXE through VI server, you will get the development environment value if you use a local property node and you should get the RTE value if you use a reference to the remote app). You can use any LabVIEW executable to run project VIs (unbuilt source code) in the run time engine (just pass it the VIs paths as command-line arguments). This is a trick that I learned from Jean-Pierre Drolet, some time ago. If you want a degenerate LabVIEW executable, just make a copy of "<LabVIEW>\applibs\lvapp.lib" and rename it as "anything.exe". Quote Link to comment
Yair Posted August 29, 2007 Report Share Posted August 29, 2007 OK, I see the distinction you're making - it's VIs running in the RTE vs. VIs which were part of the actual build. Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.