打开文件对话框,若异常则打开文件夹对话框。
实现方法如下
export prototype number OpenFileDialog(byref string);
//Open File Dialog User Com object "UserAccounts.CommonDialog"
function OpenFileDialog(szFileFullPath)
OBJECT ObjDialog;
begin
try
set ObjDialog = CreateObject("UserAccounts.CommonDialog") ;
ObjDialog.Filter = "Access File(*.mdb)|*.mdb";//|All Files(*.*)|*.*" ;
//ObjDialog.FilterIndex = 1;
//ObjDialog.InitialDir = "c:\\";
//Open File Dialog
if ObjDialog.ShowOpen() then
szFileFullPath = ObjDialog.FileName;
endif;
catch
set ObjDialog = NOTHING;
return -1;
endcatch;
set ObjDialog = NOTHING;
return 0;
end;