OpenFileDialog

This method is used to support calls to CreateCommandLineProcessAsync. Due to established security measures, TerraExplorer only allows files or folders that were selected by the user to be passed as parameter values to executables (.exe).

This method allows you to open a dialog in which the user can designate a specific file or directory whose path can be passed as a parameter to an executable. OpenFileDialog returns a JSON that includes a file/directory path key. This key can be passed in CreateCommandLineProcessAsync's CommandLine parameter. It is then replaced by TerraExplorer with the actual path.

See "Launching a TerraExplorer Executable Tool" for an example of how this method is implemented.

JavaScript

 

OpenFileDialog (

       Folder,

       Filter)

 

C#

 

string OpenFileDialog (

       [bool Folder = False],

       [string Filter = ])

 

C++

 

HRESULT OpenFileDialog (

       VARIANT_BOOL Folder,

       BSTR Filter,

       BSTR* json)

 

Parameters

Folder

A Boolean that determines whether a file selection or folder selection dialog will open. Set to TRUE to open a folder selection dialog.

Filter

Any valid filter which determines the choices that appear in the dialog. For each filtering option, the filter string contains a description of the filter, followed by the vertical bar (|) and the filter pattern. The strings for different filtering options are separated by the vertical bar.
This parameter is applied only when the Folder parameter is set to TRUE.
The following is an example of a filter string:

"3dml files (*.3dml)|*.3dml"

Return Value

json

A JSON that includes the selected file/directory path and a key with this information. This key can be passed in CreateCommandLineProcessAsync's CommandLine parameter. It is then replaced by TerraExplorer with the actual path. E.g.,

{

   "file_path" : "C:\\Folder\\FileName.3dml",

   "key" : "${58526B12-746D-4F71-936A-E35ED27D8EB9}"

}

Exceptions

HRESULT can return any of the values listed in the HRESULT Return Values list.