终于写出了一部分的带预览的打开文件对话框,只是返回文件名部分还不知道怎么搞:
- Private Declare Function acedGetFileNavDialog Lib _
- "acad.exe" (ByVal title As String, ByVal default As String, ByVal ext As String, _
- ByVal dlgname As String, ByVal flags As Integer, result As Variant) As Integer
- Public Function OpenFile(ByVal title As String, ByVal defawlt As String, ByVal ext As String) As Variant
- Dim result As Variant
- acedGetFileNavDialog title, defawlt, ext, title, 0, result
- OpenFile = result
- End Function
- Sub gf()
- OpenFile "打开文件-明经通道VBA示例", "", "dwg"
- End Sub
但因为我对C++的自定义数据类型不清楚,所以打开文件的对话框函数不能返回选定的文件。
张版主请给修改一下。对话框打开后按确定或取消后出现:“运行时错误 49,DLL调用约定错误”。
|