Common Files Dialogเป็นคำสั่งที่ใช้เปิดหน้าต่างBrowse เพื่อเลือกและเปิดไฟล์ต่างๆ
Code:
var dialog = new ActiveXObject("MSComDlg.CommonDialog");
var FsoObj=new ActiveXObject("Scripting.FileSystemObject");
var objShell = new ActiveXObject("Shell.Application");
var ShellObj=new ActiveXObject("WScript.Shell");
dialog.Filter = "Program Files (*.exe;*.msi)|*.exe;*.msi|All Files (*.*)|*.*|";
dialog.MaxFileSize = 260;
dialog.DialogTitle = "Open";
dialog.InitDir = "C:\\Documents and Settings\\Administrator\\Desktop";
dialog.ShowOpen();
if (dialog.FileName != "") {
tFiles = dialog.FileName
objShell.ShellExecute(tFiles);
}


Comment