Profile

Paintoast

这家伙很懒,什么也没写
资源:1 粉丝:0

Paintoast上传的资源

纯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 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
RAR
4.64KB
2019-01-01 16:26
暂无更多数据