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
|
' -----------------------------------
' Variables globales de l'application
' -----------------------------------
' Type de donnée nécéssaire à l'application
' ---------------------------------------------
Public Type TParamsAppli
LoadFilePath As String
ArchivesFilePath As String
BeginDate As Date
EndDate As Date
End Type
Public ParamsAppli As TParamsAppli
Public Const FileCFG = "Main.CFG"
' Procedure d'Initialisation
Private Sub SetDefaultParams()
With ParamsAppli
LoadFilePath = "C:\LaurentT7 LASER\"
ArchivesFilePath = "C:\LaurentT7 LASER\Backup T7"
BeginDate = Date
EndDate = Date
End With
SaveParams
End Sub
'Chargement des paramètres au démarrage de l'application
Public Sub LoadParams()
On Error GoTo ErrorHandler
With ParamsAppli
Open MainPath + FileCFG For Input As #1
While Not EOF(1)
Line Input #1, LoadFilePath
Line Input #1, ArchivesFilePath
Line Input #1, BeginDate
Line Input #1, EndDate
Wend
Close #1
End With
Exit Sub
ErrorHandler: SetDefaultParams
End Sub
'Sauvegarde des paramètres au démarrage de l'application
Public Sub SaveParams()
On Error GoTo ErrorHandler
Open MainPath + FileCFG For Output Shared As #1
With ParamsAppli
Print #1, LoadFilePath ' --> là est le Pb....
Print #1, ArchivesFilePath ' --> les champs sont vides !!
Print #1, BeginDate
Print #1, EndDate
Close #1
End With
Exit Sub
ErrorHandler: MsgBox ("Problème avec le fichier de configuration")
End Sub |