1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| Option Explicit
Dim Chemin, Fichier, Resultat As String
Dim NamIndx(34) As String
Dim T, U As Byte
Dim LargMin, HautMin As Integer
Private Sub Form_Resize()
If Me.WindowState <> vbMinimized Then
If Me.WindowState = vbNormal Then
If Me.Height < 1035 Then Me.Height = 1035
If Me.Width < 2670 Then Me.Width = 2670
End If
List1.Height = (Me.Height - List1.Top) - (List1.Left * 8)
List1.Width = Me.Width - (List1.Left * 4)
End If
End Sub
Private Sub Form_Load()
NamIndx(0) = "Name": NamIndx(1) = "Size": NamIndx(2) = "Type"
NamIndx(3) = "Date Modified": NamIndx(4) = "Date Created": NamIndx(5) = "Date Accessed"
NamIndx(6) = "Attributes": NamIndx(7) = "Status": NamIndx(8) = "Owner"
NamIndx(9) = "Author": NamIndx(10) = "Title": NamIndx(11) = "Subject"
NamIndx(12) = "Category": NamIndx(13) = "Pages": NamIndx(14) = "Comments"
NamIndx(15) = "Copyright": NamIndx(16) = "Artist": NamIndx(17) = "Album Title"
NamIndx(18) = "Year": NamIndx(19) = "Track Number": NamIndx(20) = "Genre"
NamIndx(21) = "Duration": NamIndx(22) = "Bit Rate": NamIndx(23) = "Protected"
NamIndx(24) = "Camera Model": NamIndx(25) = "Date du cliché": NamIndx(26) = "Dimensions"
NamIndx(27) = "Not used": NamIndx(28) = "Not used": NamIndx(29) = "Not used"
NamIndx(30) = "Company": NamIndx(31) = "Description": NamIndx(32) = "File Version"
NamIndx(33) = "Product Name": NamIndx(34) = "Product Version"
U = 0
For T = 0 To 34
If Len(NamIndx(T)) > U Then U = Len(NamIndx(T))
Next T
U = U + 1
For T = 0 To 34
NamIndx(T) = NamIndx(T) & String$(U - Len(NamIndx(T)), " ") & ": "
If T < 10 Then NamIndx(T) = " " & NamIndx(T)
Next T
List1.Clear
End Sub
Private Sub Command1_Click()
CommonDialog1.Flags = cdlOFNFileMustExist + cdlOFNHideReadOnly
CommonDialog1.Flags = CommonDialog1.Flags + cdlOFNPathMustExist + cdlOFNExplorer
CommonDialog1.CancelError = True
On Error Resume Next
CommonDialog1.ShowOpen
If Err.Number <> 0 Then On Error GoTo 0: Exit Sub
Fichier = CommonDialog1.FileTitle
Chemin = Left$(CommonDialog1.FileName, Len(CommonDialog1.FileName) - Len(Fichier))
informationsFichier
LargMin = (LargMin + 1) * LabLargeFonte.Width
HautMin = (240 * (List1.ListCount - 1))
'redimenssionnes si besoin
If List1.Height < HautMin Then
List1.Height = HautMin
Me.Height = List1.Height + List1.Top + (List1.Left * 8)
End If
If List1.Width < LargMin Then
List1.Width = LargMin
Me.Width = LargMin + (List1.Left * 4)
End If
End Sub
Public Sub informationsFichier()
'recuperé sur ce forum pour avoir les infos que tu recherche
'necessite d'activer reference Microsoft Shell Controls and Automation
Dim objShell As Shell
Dim objFolder As Folder
Dim strFileName As FolderItem
Set objShell = CreateObject("Shell.Application")
Set objFolder = objShell.NameSpace(Chemin) 'adapter le chemin
Set strFileName = objFolder.Items.Item(Fichier) 'adapter le fichier
List1.Clear: LargMin = 0
For T = 0 To 34
If objFolder.GetDetailsOf(strFileName, T) <> "" Then
List1.AddItem CStr(T) & " " & NamIndx(T) & Trim$(objFolder.GetDetailsOf(strFileName, T))
If LargMin < Len(List1.List(List1.NewIndex)) Then LargMin = Len(List1.List(List1.NewIndex))
End If
Next
Set objShell = Nothing: Set objFolder = Nothing: Set strFileName = Nothing
End Sub |
Partager