Enregistrer l'état d'un fenêtre dans un fichier .ini
timon23
Messages postés23Date d'inscriptionmercredi 14 mai 2008StatutMembreDernière intervention24 juin 2008
-
27 mai 2008 à 14:41
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 2021
-
27 mai 2008 à 15:09
Bonjour a tous
J'aimerais savoir comment faire pour enregistrer l'état de ma fenêtre quand je ferme mon apllication.
Par exemple si elle a été agrandie je veut que quand je redémarre l'application quel soit comme j'était avant.
J'ai une fonction EcrireIni mais je n'arrive pas a l'utiliser
Code:
'
'Ecrire dans le fichier .Ini
'
PrivateDeclare 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 lpFileNameAs String) As Long
Public
Sub
EcrireIni(stSection As String, stKey As String, stValeur As String, stfichier As String)
' Lecture d'une valeur dans un fichier INI
' stSection est le la partie designée entre crochets ([option] par exemple)
' stKey est le nom de la clé à récupérer (COULEUR=... par exemple)
' stValeur est la valeur à stocker
' stFichier est le fichier à manipuler
Renfield
Messages postés17287Date d'inscriptionmercredi 2 janvier 2002StatutModérateurDernière intervention27 septembre 202174 27 mai 2008 à 15:09
je ne vois pas pourquoi tu as cette fonction, qui se trouve être si proche de la déclaration API ^^
tu peux utiliser
Public Declare Function GetPrivateProfileString Lib "kernel32.dll" Alias "GetPrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As String, ByVal nSize As Long, ByVal lpFileName As String) As Long
Public Declare Function WritePrivateProfileString Lib "kernel32.dll" Alias "WritePrivateProfileStringA" (ByVal lpApplicationName As String, ByVal lpKeyName As Any, ByVal lpString As Any, ByVal lpFileName As String) As Long
Public Property Get Setting(ByRef vsSection As String, ByRef vsKey As String) As String
Dim nLength As Long
nLength = 1024
Setting = Space$(nLength)
nLength = GetPrivateProfileString(vsSection, vsKey, vbNullString, Setting, nLength, App.Path & "" & App.EXEName & ".ini")
Setting = Left$(Setting, nLength)
End Property
Public Property Let Setting(ByRef vsSection As String, ByRef vsKey As String, ByRef Value As String)
WritePrivateProfileString vsSection, vsKey, Value, App.Path & "" & App.EXEName & ".ini"
End Property