sTmp is returned as the filename, if it has LEN(sTMp) then control set text it onto your edit control.
Code:
lResult = CCSFileDialog(ByVal CbHndl, _ ' parent window ByVal "Open File", _ ' caption sTmp, _ ' filename WorkingDir , _ ' start directory ByVal sFilter, _ ' filename filter "Ini", _ ' wDefault extension %OFN_OVERWRITEPROMPT Or %OFN_EXPLORER, _ ' flags %FALSE) ' Type of Dialog If IsFalse lResult Or IsFalse Len(sTmp) Then Exit Function Else g_IniFile = sTmp sTmp = g_szMine & " - " & g_szVer & " - " & g_IniFile SetWindowText ByVal CbHndl,ByVal StrPtr(sTmp) End If If IsTrue Exist(ByVal g_IniFile) Then lResult = LoadIniFile() Else Exit Function End If '========================================================================================================= Function CCSFileDialog(ByVal hWnd As Long, _ ' parent window ByVal Caption As String, _ ' caption Filespec As String, _ ' filename ByVal InitialDir As String, _ ' start directory ByVal Filter As String, _ ' filename filter ByVal DefExtension As String, _ ' wDefault extension Flags As Long, _ ' flags TypeOfDialog As Long) As Long ' SaveAs or Open? Local Ofn As OPENFILENAME Local zFile As Asciiz * 256 Local zFileTitle As Asciiz * 256 Local zFilter As Asciiz * 256 Local zInitialDir As Asciiz * 256 Local zTitle As Asciiz * 256 Local zDefExt As Asciiz * 10 Replace "|" With Chr$(0) In Filter Filter = Filter & Chr$(0) If Len(InitialDir) = 0 Then InitialDir = CurDir$ End If zFilter = Filter + Chr$(0) zInitialDir = InitialDir + Chr$(0) zFile = Filespec + Chr$(0) zDefExt = DefExtension + Chr$(0) zTitle = Caption + Chr$(0) ofn.lStructSize = SizeOf(ofn) ofn.hWndOwner = hWnd ofn.lpstrFilter = VarPtr(zFilter) ofn.nFilterIndex = 1 ofn.lpstrFile = VarPtr(zFile) ofn.nMaxFile = SizeOf(zFile) ofn.lpstrFileTitle = VarPtr(zFileTitle) ofn.nMaxFileTitle = SizeOf(zFileTitle) ofn.lpstrInitialDir = VarPtr(zInitialDir) If Len(zTitle) Then ofn.lpstrTitle = VarPtr(zTitle) End If ofn.Flags = Flags ofn.lpstrDefExt = VarPtr(zDefExt) If IsTrue TypeOfDialog Then Function = GetSaveFilename(ofn) Else Function = GetOpenFilename(ofn) End If InitialDir = CurDir$ Filespec = zFile Flags = ofn.Flags End Function
Leave a comment: