winexec

The winexec function enables you to execute another program while running the translator.

This program is executed asynchronously. You specify the program and determine how you want the program window displayed. You can also return an error code, if desired. If the error code is greater than 32, the program ran without errors. If the error code is less than 32, the program did not run because of an error. If the error code is "0," the system is out of memory. If the error code is "2," you didn’t specify a file name. The error code is not the return value from the program you executed.

Notes:
  • If you specify a program on another machine or in another domain, you must have the appropriate permission to access the specified folder.
  • If translation is executing from an unattended process control command, the user ID under which that service is running must have the appropriate permission to access the specified file.

Syntax

winexec("program",window_display)

where:

  • program = executable program name string (if necessary, including UNC or direct file path)
  • window_display = number that indicates how you want the program window displayed (see Window display numbers, below)

Example

winexec("program.exe", 3)

//Exits Gentran:Server and executes the "program.exe" program asynchronously.
//The system displays the program window maximized (3).

Window display numbers

The window_display numbers that control the appearance of the program window are as follows (you must use the number to indicate how you want the program window displayed, not the window_display value):

Table 1. Window display numbers
Number Window_Display Definition
0 SW_HIDE Hides the window and activates another window.
1 SW_SHOWNORMAL Activates and displays a window. If the window is minimized or maximized, it is restored to the original size and position. This flag should be specified when displaying a window for the first time.
1 SW_NORMAL Activates and displays a window in the original size and position.
2 SW_SHOWMINIMIZED Activates the window and displays it as a minimized windows.
3 SW_SHOWMAXIMIZED Activates the window and displays it as a maximized window.
3 SW_MAXIMIZE Maximizes the window.
4 SW_SHOWNOACTIVATE Displays the window in its most recent size and position, but does not activate it (the current active window remains active).
5 SW_SHOW Activates the window and displays it in its current size and position.
6 SW_MINIMIZE Minimizes the window.
7 SW_SHOWMINNOACTIVE Displays the window as a minimized window without activating it (the current active window remains active).
8 SW_SHOWNA Displays the window in its most recent size and position without activating it (the current active window remains active).
9 SW_RESTORE Activates and displays the window. If the window was minimized or maximized, it is restored to its original size and position.
10 SW_SHOWDEFAULT Activates the window and allows Microsoft Windows to determine the size and position.