纯API 打开保存对话框

时间:2014-03-25 03:09:52
【文件属性】:

文件名称:纯API 打开保存对话框

文件大小:5KB

文件格式:RAR

更新时间:2014-03-25 03:09:52

纯API 打开保存对话框

VB 纯API 打开保存对话框 Public Function FileDialog(FormObject As Form, SaveDialog As Boolean, ByVal Title As String, ByVal Filter As String, Optional ByVal FileName As String, Optional ByVal Extention As String, Optional ByVal InitDir As String) As String Dim OFN As OPENFILENAME Dim r As Long If Len(FileName) > MAX_PATH Then Call MsgBox("Filename Length Overflow", vbExclamation, App.Title + " - FileDialog Function"): Exit Function FileName = FileName + String(MAX_PATH - Len(FileName), 0) With OFN .lStructSize = Len(OFN) .hwndOwner = 0 .hInstance = App.hInstance .lpstrFilter = Replace(Filter, "|", vbNullChar) .lpstrFile = FileName .nMaxFile = MAX_PATH .lpstrFileTitle = Space$(MAX_PATH - 1) .nMaxFileTitle = MAX_PATH .lpstrInitialDir = InitDir .lpstrTitle = Title .flags = OFN_HIDEREADONLY Or OFN_OVERWRITEPROMPT Or OFN_CREATEPROMPT .lpstrDefExt = Extention End With Dim L As Long L = GetTickCount If SaveDialog Then r = GetSaveFileName(OFN) Else r = GetOpenFileName(OFN) If GetTickCount - L < 20 Then OFN.lpstrFile = "" If SaveDialog Then r = GetSaveFileName(OFN) Else r = GetOpenFileName(OFN) End If If r = 1 Then FileDialog = Left$(OFN.lpstrFile, InStr(1, OFN.lpstrFile + vbNullChar, vbNullChar) - 1) End Function


【文件预览】:
纯API 打开保存对话框
----Form1.frm(2KB)
----工程1.vbp(677B)
----MSSCCPRJ.SCC(190B)
----打开保存.bas(12KB)
----工程1.vbw(82B)

网友评论