Public Type OPENFILENAME
lStructSize As Long
hwndOwner As Long
hInstance As Long
lpstrFilter As String
lpstrCustomFilter As String
nMaxCustFilter As Long
nFilterIndex As Long
lpstrFile As String
nMaxFile As Long
lpstrFileTitle As String
nMaxFileTitle As Long
lpstrInitialDir As String
lpstrTitle As String
flags As Long
nFileOffset As Integer
nFileExtension As Integer
lpstrDefExt As String
lCustData As Long
lpfnHook As Long
lpTemplateName As String
End Type
Public Declare Function GetOpenFileName Lib "comdlg32.dll" Alias "GetOpenFileNameA" (pOpenfilename As OPENFILENAME) As Long
Public Function FileSelect()
Dim OFN As OPENFILENAME
OFN.lStructSize = Len(OFN)
OFN.hwndOwner = Form2.hWnd
OFN.hInstance = App.hInstance
OFN.lpstrFilter = "Тип файлов (*.wav)" + Chr$(0) + "*.wav" + Chr$(0) _
& "Тип файлов (*.mp3)" + Chr$(0) + "*.mp3" + Chr$(0) _
'& "Тип файлов (*.midi)" + Chr$(0) + "*.midi" + Chr$(0) _
'& "Все файлы (*.*)" + Chr$(0) + "*.*"
OFN.lpstrFile = Space$(254)
OFN.nMaxFile = 255
OFN.lpstrFileTitle = Space$(254)
OFN.nMaxFileTitle = 255
OFN.lpstrInitialDir = CurDir
OFN.lpstrTitle = "Our File Open Title"
OFN.flags = 0
PathToFiles = GetOpenFileName(OFN)
If (PathToFiles) Then
Form1.PathToFiles = Trim$(OFN.lpstrFile)
Else
Form1.PathToFiles = ""
End If
Form1.Enabled = True
End Function
Option Explicit
Public PathToFiles As String
'--------------------------------------------
Private Sub Command1_Click()
Call FileSelect
End Sub
Сейчас этот форум просматривают: AhrefsBot, Yandex-бот и гости: 27