Compartilhar via


DexFileLaunch()

The DexFileLaunch() function attempts to open or print the specified file. For the web client, the function transfers the specified file from the server to the web client before the launch action is performed.

Syntax

DexFileLaunch(pathname, action)

Parameters

pathname - A string containing the native pathname indicating the file to launch.

action - An integer that specifies the launch action to take for the file. The value corresponds to one of the following constants:

Value

Description

1

The file is opened and displayed on the client machine.

2

The file is opened and printed on the client machine.

0

This action is used only for the web client. After the file has been transferred from the server to the web client, no further action is taken.

Return value

A boolean. The value true indicates the file launch action was successful, while the value false indicates that it was not.

Comments

The client operating system will select the best application to view or print the file.

Examples

The following C# example launches the file in the location indicated by the value of the textBoxFile control. If the file indicated cannot be launched, an error dialog is displayed.

bool result;

if (Dynamics.Forms.SyVisualStudioHelper.Functions.DexRuntimeGetClientType
.Invoke() == 1)
{
    // Desktop client
    result = Dynamics.Forms.SyVisualStudioHelper.Functions.DexFileLaunch
    .Invoke(textBoxFile.Text, 1);

    if (result == false)
    {
        Dynamics.Forms.SyVisualStudioHelper.Functions.DexError
        .Invoke("Could not open file");
    }
}
else
{
    // Web client
    Dynamics.Forms.SyVisualStudioHelper.Functions.DexError
    .Invoke("Action not available");
}

The following Visual Basic example launches the file in the location indicated by the value of the TextBoxFile control. If the file indicated cannot be launched, an error dialog is displayed.

Dim result As Boolean

If (Dynamics.Forms.SyVisualStudioHelper.Functions.DexRuntimeGetClientType _
.Invoke() = 1) Then

    'Desktop client
    result = Dynamics.Forms.SyVisualStudioHelper.Functions.DexFileLaunch _
    .Invoke(TextBoxFile.Text, 1)

    If result = False Then
        Dynamics.Forms.SyVisualStudioHelper.Functions.DexError _
        .Invoke("Could not open file")
    End If
Else
    'Web client
    Dynamics.Forms.SyVisualStudioHelper.Functions.DexError _
    .Invoke("Action not available")
End If