Common Dialog without OCX
Hi All, The Perpose of this Progarm is to Use windows Common Dialog Control Control Without the COMDLG32.OCX file. This will work even if the File is not Present This is only for Open and Save Functions. But You can append it to get Color and other Dialog Boxes too, Just Send any comments to visual_basic@manjulapra.com Visit me at http://www.manjulapra.com Thank You
AI
Resumo por IA: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.
Código fonte
'This Function sets the Filters for the Common Dialog
'It is basically the Same as in Commondialog OCX But when You want Multiple Filter Use as
'"All Files|*.*|Executable Files|*.exe"
Private Sub DialogFilter(WantedFilter As String)
Dim intLoopCount As Integer
strfileName.lpstrFilter = ""
For intLoopCount = 1 To Len(WantedFilter)
If Mid(WantedFilter, intLoopCount, 1) = "|" Then strfileName.lpstrFilter = _
strfileName.lpstrFilter + Chr(0) Else strfileName.lpstrFilter = _
strfileName.lpstrFilter + Mid(WantedFilter, intLoopCount, 1)
Next intLoopCount
strfileName.lpstrFilter = strfileName.lpstrFilter + Chr(0)
End Sub
'This is The Function To get the File Name to Open
'Even If U don't specify a Title or a Filter it is OK
Public Function fncGetFileNametoOpen(Optional strDialogTitle As String = "Open", Optional strFilter As String = "All Files|*.*", Optional strDefaultExtention As String = "*.*") As String
Dim lngReturnValue As Long
Dim intRest As Integer
strfileName.lpstrTitle = strDialogTitle
strfileName.lpstrDefExt = strDefaultExtention
DialogFilter (strFilter)
strfileName.hInstance = App.hInstance
strfileName.lpstrFile = Chr(0) & Space(259)
strfileName.nMaxFile = 260
strfileName.flags = &H4
strfileName.lStructSize = Len(strfileName)
lngReturnValue = GetOpenFileName(strfileName)
fncGetFileNametoOpen = strfileName.lpstrFile
End Function
'This Function Returns the Save File Name
'Remember, U have to Specify a Filter and default Extention for this
Public Function fncGetFileNametoSave(strFilter As String, strDefaultExtention As String, Optional strDialogTitle As String = "Save") As String
Dim lngReturnValue As Long
Dim intRest As Integer
strfileName.lpstrTitle = strDialogTitle
strfileName.lpstrDefExt = strDefaultExtention
DialogFilter (strFilter)
strfileName.hInstance = App.hInstance
strfileName.lpstrFile = Chr(0) & Space(259)
strfileName.nMaxFile = 260
strfileName.flags = &H80000 Or &H4
strfileName.lStructSize = Len(strfileName)
lngReturnValue = GetSaveFileName(strfileName)
fncGetFileNametoSave = strfileName.lpstrFile
End Function
Comentários originais (3)
Recuperado do Wayback Machine