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
|
Private Declare Function GetPrivateProfileString Lib "kernel32" Alias "GetPrivateProfileStringA" _ (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpDefault As String, _ ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Private Declare Function WritePrivateProfileString Lib "kernel32" Alias "WritePrivateProfileStringA" _ (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, _ ByVal lpFileName As String) As Long
Private Function EcritDansFichierIni(Section As String, Cle As String, _ Valeur As String, Fichier As String)
As Long EcritDansFichierIni = WritePrivateProfileString(Section, Cle, Valeur, Fichier)
End Function
Private Function LitDansFichierIni(Section As String, Cle As String, Fichier As String, _ Optional ValeurParDefaut As String = "") As String
Dim strReturn As String
strReturn = String(255, 0)
GetPrivateProfileString Section, Cle, ValeurParDefaut, strReturn, Len(strReturn), Fichier
LitDansFichierIni = Left(strReturn, InStr(strReturn, Chr(0)) - 1)
End Function
Dim rep As String
rep = Dir("E:\w\scan rep", vbDirectory)
Do While (rep <> "")
If (GetAttr(rep) And vbDirectory) = vbDirectory Then
EcritDansFichierIni "Affichage", "State", "Maximized", "E:\w\scan rep\presentations\config.ini"
EcritDansFichierIni "Affichage", "Left", "50", "E:\w\scan rep\presentations\config.ini"
EcritDansFichierIni "Affichage", "Top", "80", "E:\w\scan rep\presentations\config.ini"
End If
rep = Dir
Loop |
Partager