v5.0 / 14 of 23 / 01 sep 99 / gvg
* This chapter provides an overview of HP VEE Runtime, showing how programs should be designed to work in it and how the operation of VEE Runtime can be customized under Windows.
* HP VEE is an "interpreted" language, meaning that VEE programs can only be
run if VEE is installed on the target computer. Versions of VEE for 4.0 and
later are sometimes referred to as "compiled", but this only means that
programs are converted into an intermediate "p-code" format before they are
executed, in order to improve performance. It does not mean that VEE can
create stand-alone executable files.
However, many users simply want to run VEE programs, not write them, and so
from early on, VEE was offered in two versions: a full development
environment to allow program development and execution, and a "runtime"
version that allows a user to run a program, but not modify it.
Originally, the VEE Runtime version was a separate product, but this was a
clumsy and inconsiderate scheme. As of VEE 4.0, VEE Runtime was shipped with
the product, along with an unlimited license to duplicate. VEE Runtime was
made available as a set of floppy disk images on the VEE development CD-ROM
that could be copied onto floppies and shipped with a VEE application. VEE
Runtime was even placed on publicly-accessible websites to allow anyone who
needed it to pick it up for free.
While there had been a long string of requests for VEE to generate
stand-alone executable programs, this measure effectively eliminated that
concern. Not only could VEE programs be run on any desired target system
(with little more overhead than would have been imposed by trying to build
true executables, containing large VEE run-time libraries), VEE Runtime was
also rethought to make runtime programs act very much like executable files.
This was a very useful feature that led to a number of complications.
* The rethinking of VEE Runtime in VEE 4.0 was subtle and a bit confusing.
Although earlier versions of VEE allowed the programmer to secure a normal
VEE program file, making it runnable but not viewable, VEE 4.0 introduced the
concept of a "secured runtime VEE program".
If a VEE 4.0 programmer developed a VEE program, it would be saved with a
.VEE extension, and if the programmer wanted to save it in a secured runtime
format, it would be saved in a separate file having (by default) the same
name, but a .VXE extension.
This prevented a programmer from accidentally securing a program, which had
been a problem with older versions of VEE. Accidentally securing a VEE
program was disastrous because there was, and is, no way to "unsecure" it.
Most of the program's "detail view" is thrown away, making reconstruction
difficult or impossible.
It also had another benefit. The new .VXE extension stood for "VEE
Executable", and that's what programs with that extension appeared to be.
They could be executed from Windows just like any other executable program,
by clicking on them from Windows Explorer, creating an icon for them, and so
on.
This was done through a neat bit of deception. The VEE Runtime version still
had to be installed to allow a .VXE program to run, but during installation
the Runtime install program created an "association" in Windows between
Runtime and files with a .VXE extension.
The association is simply a rule given to Windows to tell it to activate VEE
Runtime if a file with a .VXE extension is selected. That is, if a user
brings up Windows My Computer or File Manager, and clicks on a filename with
a .VXE extension, VEE Runtime automatically and invisibly runs, loads the .VXE
file, and executes it. As far as the user is concerned, the .VXE file acts
just like an executable program.
* This change in Runtime strategy was made in response to user inputs, but it
did imply certain changes in the way VEE Runtime operated that caused some
users trouble. Unfortunately, these changes were not clearly documented and
some confusion resulted.
As described above, the current VEE Runtime operates in a fashion transparent
to the user. The user sees the VEE program but never sees VEE Runtime as
such. The earlier version of VEE Runtime was more like a stripped-down
version of the development environment. It actually had a menu system to
allow users to load different VEE programs and run them, though not edit
them.
As of VEE 4.0 Runtime, that was no longer possible. VEE Runtime ran one
program invisibly, and died when the program finished execution. Losing the
ability to load programs didn't prove to be too much of a difficulty,
however, since it is simple under Windows to set up icons for multiple VEE
Runtime programs, as will be shown presently.
* The fact that programs executed and then died caused more trouble. Put
another way, VEE Runtime has no "idle" state: it operates only as long as a
VEE program is running. This is different from the development environment,
where a program can be run, stopped, edited, run again, and so on. The new
Runtime requires that the program itself be designed to determine when it
exits and disappear.
There is an implication in this behavior that proved particularly
troublesome: Autostart objects don't work.
Some VEE input objects have an Autostart flag that can be set in their
properties to force execution of a VEE thread when that object is activated.
This feature is mostly a relic from the early days of VEE and never worked
very well for programs of any complexity, and its use was generally
discouraged. However, there is one VEE object, the Start button, that is
inherently an Autostart object and has been in common use.
The problem is not precisely that the Autostart objects were broken by VEE
4.0 Runtime. It would be more accurate to say they do work, but don't give
the same results as they did with older versions of VEE Runtime. An
Autostart object implies an idle state in VEE to even make sense, and as
noted, VEE 4.0 Runtime doesn't have concept of an idle state.
This meant that programs running under the new VEE Runtime that include
Autostart objects simply load, execute, and die. Autostart objects -- Start
buttons in the most common case -- have to be eliminated from a Runtime
program.
Consider the simple example program below:
It is easy to change this program so that it executes properly in Runtime.
The trick is to exchange the Start button for an Until Break object and an
OK button (set to "Wait for Input" mode under its properties):
The program is always running, and so won't die -- unless the user clicks on
the "X" button in the upper right corner of the Runtime panel, or otherwise
forcibly exits the program. When the OK button is waiting for input, VEE
won't "hog" the CPU -- that is, Windows will be able to do other things while
the VEE program is waiting for the user to do something.
In general, if a VEE program has threads that are initiated by Start buttons,
then the program can be made to work correctly under Runtime by replacing
each Start button with an Until Break and an OK button.
Similarly, a program driven by, for instance, a Slider set to Autostart mode
could be modified by changing the Slider's mode to "Wait for Input" and
driving it with an Until Break object. In any case, the changes are simple,
but it was regrettable that more warning was not given about their need.
* For a bit more elaborate example, consider a program that has multiple
threads driven by Start buttons:
* This discussion leads to a more complicated consideration of VEE control
flow in general, but that would be well beyond the scope of immediate concern
and is discussed elsewhere.
* Given the whole "VEE executable" Runtime scheme, it is simple to run VEE
programs under Windows.
The easiest way to run them is to simply find the .VXE program file with
Windows Explorer or My Computer, and double-click on the file icon with a
mouse. Due to the association between the .VXE file name extension and VEE
Runtime, the program is run immediately.
It's just as easy to set up a "shortcut" icon for the .VXE program that can
be placed in the Windows desktop. If you click on the .VXE program with the
alternate (usually the right) mouse button, you get a menu:
This shortcut icon can then be moved to the Windows Desktop with a click and
drag mouse operation. Using a shortcut ensures that the user won't have
direct access to the .VXE program. For instance, deleting the shortcut icon
won't delete the actual program.
If you want to provide a collected set of shortcut icons, you can create a
directory underneath "\Windows\Desktop" named, say, "VEE Shortcuts", and
move the shortcut icons to this directory. The directory folder will appear
on the Windows desktop, and opening it will give access the shortcuts.
* The shortcuts can also be installed in the Windows Start menu. If you
click on the Windows Taskbar with the alternate mouse button, you get a
dialogue box of the form:
If you use this technique to put a shortcut to a .VXE program in the
"StartUp" folder in the Start menu, then the .VXE program will be
automatically executed when Windows boots.
* If you click on a shortcut with the alternate mouse button, you get a
dialogue box to allow you to perform some customizations, of the form:
To set the shortcut key, you just select that field with the mouse and press
the desired keys. To change the icon, you use the "Change Icon" button to
get a browser that allows you to select programs or DLLs containing the
desired icon files. Of course if these files move, the icon changes back to
default.
The number of different possibilities in setting up icons under Windows is
large and this is just an introduction to useful techniques.
* The current VEE runtime allows use of the following command-line options:
* What if you want to use these options to modify the operation of VEE
Runtime? There are two cases to consider:
Modifying the association between VEE Runtime and all .VXE programs can be
done by selecting the View -> Options menu selection from Windows My Computer
or Windows Explorer. This gives a dialogue box:
Now suppose you want all .VXE programs to be run with the same VEE Runtime
command line option, such as "-maximize". Then you would add the option in
the "Application used ..." field as follows:
This done, you exit through all the dialogues by clicking on "OK", then
"Close", then "Close" until you get back to My Computer or Explorer. From
now on, all .VXE programs will run by default with a maximized window.
* But what if you only want special options for specific .VXE programs?
Then, as noted, you have to create shortcuts for VEE Runtime that
specifically run each of the specific .VXE programs with the proper options.
It is of course possible to make a shortcut for VEE Runtime, as it is with
any other Windows file. For a simple and useful example, if you want to
allow a user to set up VEE I/O configuration when only VEE Runtime is
installed, this can be done by creating a shortcut for VEE Runtime and
customizing the "Target" field (using the same procedure as outlined in
section 4 of this document) to:
In this example, VEE Runtime executes without running a .VXE program, which
is generally not very useful. In fact, this is the only example I can think
of where it is* useful to invoke it without a program.
Getting back to the main point, then, if you want to:
-- then you would create a shortcut for VEE Runtime and add the option and
the .VXE file in the "Target" field:
A separate shortcut needs to be set up for each .VXE program that is run with
custom options.
* It is in principle possible to set up different "classes" of .VXE programs,
that are run with options specific to each class. This can be done by
renaming .VXE files to customized extensions appropriate to the different
classes -- .VX1, .VX2, .VX3, and so on -- and setting up a different
customized association for each class.
However, this is an ugly sort of improvisation that is likely to lead to
confusion down the road, and the only reason I bring it up is to suggest that
it is not recommended.
[14.1] OVERVIEW
[14.2] VEE EXECUTABLES & VEE RUNTIME
[14.3] RUNTIME IMPLICATIONS FOR PROGRAM DESIGN
[14.4] ACCESSING RUNTIME PROGRAMS UNDER WINDOWS
[14.5] RUNTIME OPTIONS & MODIFYING RUNTIME BEHAVIOR
[14.1] OVERVIEW
[14.2] VEE EXECUTABLES & VEE RUNTIME
[14.3] RUNTIME IMPLICATIONS FOR PROGRAM DESIGN
+-------+
| Start |
+---+---+
|
+-----+-----+
| VEE Code |
+-----------+
This works in the VEE development environment, but when loaded under VEE
Runtime, it immediately executes and die. This is as per the new rules: the
code is automatically run on being loaded, and when it is finished running,
VEE Runtime dies.
+-------+
| Until |
| Break +---+
+-------+ |
|
+--+--+
| OK +--+
+-----+ |
|
+-----+-----+
| VEE Code |
+-----------+
On loading the program in Runtime, the Until Break fires and "arms" the OK
button, waiting for a user to click on it. When the user clicks on it, the
thread executes, and when done the Until Break fires and arms the OK button
for the next go-round.
+-------+ +-------+
| Start | | Start |
+---+---+ +---+---+
| |
+-----+-----+ +-----+-----+
| Thread 1 | | Thread 2 |
| Objects | | Objects |
+-----------+ +-----------+
-- can be similarly modified to work under VEE Runtime as follows:
+-------+ +-------+
| Until | | Until |
| Break +--+ | Break +--+
+-------+ | +-------+ |
| | OK Button
+--+--+ +--+--+ +------+
| OK | | OK | | Quit +--+
+--+--+ +--+--+ +------+ |
| | |
+-----+-----+ +-----+-----+ +---+---+
| Thread 1 | | Thread 2 | | Stop |
| Objects | | Objects | +-------+
+-----------+ +-----------+
Note how a new thread is added to allow the user to quit the program.
[14.4] ACCESSING RUNTIME PROGRAMS UNDER WINDOWS
+-----------------+
| Open |
+-----------------+
| Send To |
+-----------------+
| Cut |
| Copy |
+-----------------+
| Create Shortcut |
| Delete |
| Rename |
+-----------------+
| Properties |
+-----------------+
If you click on the "Create Shortcut" entry, you get an additional new entry
in the file listing labelled "Shortcut to <.VXE program>". The icon will
have a little arrow in a box in one corner to let you know that it's a
shortcut.
+-------------------------------------------------------+
| Taskbar Properties [?][x] |
+-------------------------------------------------------+
| +-----------------+---------------------+ |
| | Taskbar Options | Start Menu Programs | |
| +-----------------+ +-----------+ |
| | | |
| | +- Customize Start Menu ------------------------+ | |
| | | | | |
| | | You may customize your Start Menu by | | |
| | | adding or removing menu items from it. | | |
| | | | | |
| | | | | |
| | | | | |
| | | [ Add... ] [ Remove... ] [ Advanced... ] | | |
| | +-----------------------------------------------+ | |
| | | |
| | +- Customize Start Menu ------------------------+ | |
| | | | | |
| | | Click the button to remove the contents | | |
| | | of the Documents Menu. | | |
| | | | | |
| | | [ Clear ] | | |
| | +-----------------------------------------------+ | |
| | | |
| +---------------------------------------------------+ |
| [ OK ] [ Cancel ] [ Apply ] |
+-------------------------------------------------------+
If you click on the "Advanced" button, you get a copy of Windows Explorer
that displays the hierarchy of entries in the Start menu. Shortcut icons for
.VXE programs can be moved or copied into this hierarchy, and new folders can
be made to set up collections of them. After this is done, the .VXE programs
can be run from the Start menu.
+-------------------------------------------------------+
| Shortcut to VEETest.vxe Properties [?][x] |
+-------------------------------------------------------+
| +---------+----------+ |
| | General | Shortcut | |
| +---------+ +------------------------------+ |
| | | |
| | Shortcut to VEETest.vxe | |
| | | |
| | ------------------------------------------------- | |
| | | |
| | Target type: .VXE file | |
| | Target location: C:\VEE Programs | |
| | Target: [C:\VEE Programs\VEETest.vxe ] | |
| | | |
| | ------------------------------------------------- | |
| | | |
| | Start in: [ C:\Data ] | |
| | Shortcut key: [ Ctrl+Alt+I ] | |
| | Run: [ Normal Window ] | |
| | | |
| | | |
| | [ Find Target... ] [ Change Icon ... ] | |
| +---------------------------------------------------+ |
| [ OK ] [ Cancel ] [ Apply ] |
+-------------------------------------------------------+
This dialogue allows you to specify the file to run ("Target") as well as
access to a file browser to allow to select the file ("Find Target"), what
default directory to use ("Start In"), a shortcut key to run the program from
the keyboard, and the ability to change the icon.
[14.5] RUNTIME OPTIONS & MODIFYING RUNTIME BEHAVIOR
-d <directory> Set an alternate VEE install directory.
-disallowclose Don't allow closing the execution window.
-geometry Set the initial window geometry.
-help Display these command line options.
-iconic Start up the window iconized.
-ioconfig Run VEE instrument configuration.
-maximize Start up the window maximized.
-noerrdisp Suppress display of errors.
-stderr:<filename> Log error codes to a file.
-veeio <filename> Select a custom VEEIO file.
The "-geometry" option has the format:
-geometry <width>X<height>+/-<xoffset>+/-<yoffset>
The values are in pixels. Normal (positive) offsets are from the upper left
corner of the display, while negative offsets are from the lower right
corner of the display. For example:
-geometry 640X480+40+30
-- gives a window with a size of 640 x 480 pixels, placed 40 pixels from the
left of the display and 30 pixels from the top.
+-------------------------------------------------------+
| Options [?][x] |
+-------------------------------------------------------+
| +------+------------+ |
| | View | File Types | |
| +------+ +-------------------------------+ |
| | Registered file types: | |
| | +---------------------------+ | |
| | | Adobe Acrobat Document | [ New Type... ] | |
| | | Autodesk Animation Player | [ Remove ] | |
| | | Bitmap Image | [ Edit... ] | |
| | | Briefcase | | |
| | | CD Audio Track | | |
| | +---------------------------+ | |
| | | |
| | +- File type details ---------------------------+ | |
| | | | | |
| | | Extension: PDF | | |
| | | Content Type (MIME): application/pdf | | |
| | | Opens with: ACROEX32 | | |
| | | | | |
| | +-----------------------------------------------+ | |
| +---------------------------------------------------+ |
| [ OK ] [ Cancel ] [ Apply ] |
+-------------------------------------------------------+
This gives a list of file types, as governed by extension. To use this to
modify the operation of VEE Runtime for a .VXE file, just scroll down to
"HP VEE Executable", select it, and select the "Edit" button. This gives a
higher-level dialogue box:
+----------------------------------------------+
| Edit File Type |
+----------------------------------------------+
| [ ] [ Change Icon ] |
| ____________________________________________ |
| |
| Description of type: [ HP VEE Executable ] |
| |
| Content Type MIME: [ ] |
| Default Extension To Content Type: [VXE ] |
| |
| Action: |
| +------------------------------------------+ |
| | open | |
| | | |
| | | |
| +------------------------------------------+ |
| [ New...][ Edit...][ Remove ][ Set Default ] |
Click on the "Edit" button to pile yet another dialogue box on the stack:
+-----------------------------------------------------+
| Editing action for type: HP VEE Executable |
+-----------------------------------------------------+
| Action: |
| [ ] [ OK ] |
| [ Cancel ] |
| Application used to perform action: [ Browse...] |
| [ "C:\Program Files\Hewlett-Packard\] |
| |
| [ ] use DDE |
+-----------------------------------------------------+
Although you can't see it completely here, the "Application used to perform
action" is an invocation of VEE Runtime, using the full path. The path may
vary from system to system, but it will be of the form:
"C:\Program Files\Hewlett-Packard\VEE 5.0\veerun.exe"
The double quotes ("") are required because there are space characters in the
pathname. If the path doesn't have spaces, the double quotes may not be
present.
"C:\Program Files\Hewlett-Packard\VEE 5.0\veerun.exe" -maximize
Notice that the command line option is placed outside the double quotes.
Target: [...\veerun.exe" -ioconfig ]
Note that the full pathname for "veerun.exe" is abbreviated to "..." above,
but the full pathname does need to be used in the entry. In any case, if
you then run this shortcut, you get VEE's I/O configuration tools to allow
you to modify the configuration.
Target: [...\veerun.exe" -veeio c:\VIO\vio1.txt C:\Vprog\Dac.vxe ]
Once again, the full pathname of "veerun.exe" is abbreviated to "..." here,
but the actual full pathname needs to be used.