不用编,用ACTIVEX调用即可
- ;| 目录浏览对话框
- 用法: (vldos-browsedir PromptString[STRING])
- (vldos-writefile NIL)
- 参数1: 提示字符串, 如果是 nil, 缺省为 "Select Folder"
- 说明:
- 显示目录浏览对话框
- 返回值:
- [成功]: 返回所选目录路径. 如果用户选择取消, 返回 NIL
- [失败]: NIL
- |;
- (Defun vldos-browsedir (msg / WinShell shFolder path catchit rtn)
- (if (null MSG)
- (setq MSG "Select folder")
- )
- (if (setq winshell (vlax-create-object "Shell.Application"))
- (progn
- (setq shFolder
- (vlax-invoke-method WinShell 'BrowseForFolder 0 msg 1)
- catchit
- (vl-catch-all-apply
- '(lambda ()
- (setq shFolder (vlax-get-property shFolder 'self))
- (setq path (vlax-get-property shFolder 'path))
- )
- )
- )
- (vlax-release-object shFolder)
- (vlax-release-object winshell)
- (if (vl-catch-all-error-p catchit)
- (setq rtn nil)
- (setq rtn (vldos-formatpath path))
- )
- )
- )
- rtn
- )
|