PanasonicSubz
December 19th, 1999, 06:02 PM
i have been asking people for a long time, please just give me an example of puting a string in the regestry.
PanasonicSubz
PanasonicSubz
|
Click to See Complete Forum and Search --> : please help PanasonicSubz December 19th, 1999, 06:02 PM i have been asking people for a long time, please just give me an example of puting a string in the regestry. PanasonicSubz December 20th, 1999, 01:53 AM Dim varSection As String Dim varKey As String Dim varSetting As String Dim varReturned As String 'To Save the settings SaveSetting App.EXEName, varSection, varKey, varSetting varReturned = GetSetting(App.EXEName, varSection, varKey) that should work AndyK December 20th, 1999, 06:40 PM Registry is very easy but if you have a lot of what to save to registry then you program slows down really bad.....I use .ini files as save files for example I write everything to INI Here is a good example: Declare these API: (use public if you are placing it into module and private if you are placing it on the form that you are going to call them from) public 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 public 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 1) To write to INI: WritePrivateProfileString SectionName, Variable, Value, FileName 2) To read from INI: First you need to place this code into a module because it's public (you can change if you want to private but you will have to move it to form) You need this function because if you just call API strait forward then it will return integer, this function will read value as string... private Function ReadFromIni(SectionName as string, VariableName as string, FileName as string) as string Dim iReturn as string iReturn = string(255, Chr(0)) ReadFromIni = Left$(iReturn, GetPrivateProfileString(SectionName, byval VariableName, "", iReturn, len(iReturn), FileName)) End Function Now to read from ini to text1 (textbox)you can use this code: Text1 = ReadFromIni("SectionName", "Variable", "FileName") codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |