ShowFileDialog Method
Description
Show save file dialog or show open file dialog.
| ActiveX Edition | Plug-in Edition | Mac Edition |
|---|---|---|
| Since V8.0 | Since V8.0 | Since V8.0 |
Syntax
Boolean ObjectName. ShowFileDialog(Boolean SaveDialog, String Filter, Long FilterIndex, String DefExtension, String InitialDir, Boolean AllowMultiSelect, Boolean OverwritePrompt, Long Flags)
Parameters
Boolean SaveDialog: True -- show save file dialog, False -- show open file dialog.
String Filter: The filter name specifies the filter pattern (for example, "*.TXT"). To specify multiple filter patterns for a single display string, use a semicolon to separate the patterns (for example, "*.TXT;*.DOC;*.BAK"). A pattern string can be a combination of valid file name characters and the asterisk (*) wildcard character. Do not include spaces in the pattern string. To retrieve a shortcut's target without filtering, use the string "All Files\0*.*\0\0", but the program will replace "\0" with "|" automatically.
Long FilterIndex: The index of the currently selected filter in the File Types control. The buffer pointed to by Filter contains pairs of strings that define the filters. The index is 0-based.
String DefExtension: Define the default extension. GetOpenFileName and GetSaveFileName append this extension to the file name only if the user fails to type an extension. If this member is NULL and the user fails to type an extension, no extension is appended.
String InitialDir: The initial directory. The algorithm for selecting the initial directory varies on different platforms.
Boolean AllowMultiSelect: True -- allows users to select more then one files, Flase -- only allow to select one file.
Boolean OverwritePrompt: True -- If a file already exists with the same name, the old file will be simply overwritten, Flase -- not allows to save and overwritten a same name file.
Long Flags: If this parameter equals 0, the program will be initiated with the default flags, otherwise initiated with the cumstom value and paramters "AllowMultiSelect" and "OverwritePrompt" will be useless.
Return value
Boolean.
TRUE indicates success. FALSE indicates failure.
When an error occurs and IfThrowException property is TRUE, an exception will be thrown.
When FALSE is returned or an exception is thrown, check ErrorCode property and ErrorString property for error information.
See also
OnGetFilePath event
Sample
< script type="text/javascript" language="javascript" >
function btnTest_onclick(){
result = Webcam.ShowFileDialog(false, "*.TXT;*.DOC;*.BAK", 0, "TXT", "D:\\Temp\\123", true, true, 0);
alert(result);
}
function DynamicWebcam_OnGetFilePath(bSave, count, index, path, name){
alert("bSave:" + bSave);
alert("count:" + count);
alert("index:" + index);
alert("path:"+ path);
alert("name:"+name);
}
</script>
