|
-
Oct 2nd, 2002, 02:35 PM
#1
Thread Starter
Member
Ini prob.
Can antone give me some hint about saving and loading options to/from an ini file
-
Oct 2nd, 2002, 02:36 PM
#2
Frenzied Member
Search these forums. You'll find more code examples than you'll need.
-
Oct 2nd, 2002, 02:39 PM
#3
Thread Starter
Member
-
Oct 2nd, 2002, 02:42 PM
#4
PowerPoster
Well
VB Code:
'MODULE FOR RETRIEVING AND SAVING DATA TO/FROM INI DATA
Option Explicit
'API WRITE TO INI FILE
Declare Function WritePrivateProfileString _
Lib "kernel32" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, ByVal _
lpKeyName As Any, ByVal lsString As Any, _
ByVal lplFileName As String) As Long
'API READ FROM INI
Declare Function GetPrivateProfileString _
Lib "kernel32" 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
Function GetINIString(AppName, KeyName, INIFILENAME) As String
' RETURNS A STRING FROM AN INI FILE
On Error GoTo ErrGetINIString
Dim ReturnedString As String
Dim i, Size, Result As Integer
Dim SharedExtensionsDir As String
Dim SharedExtensionsServer As String
ReturnedString = Space$(256)
Size = Len(ReturnedString)
Size = GetPrivateProfileString(AppName, KeyName, "", ReturnedString, Size, INIFILENAME)
ReturnedString = Left$(ReturnedString, Size)
If ReturnedString <> "" Then
' VALUE FOUND
GetINIString = ReturnedString
Exit Function
End If
Exit Function
ErrGetINIString:
MsgBox "Problem with accessing data in ini file.", vbOKOnly, "Internal Error Message"
Exit Function
End Function
'WRITES A STRING TO AN INI FILE
Function WriteINI(strsection As String, strkey As String, strkeyvalue As String, strfullpath As String)
Call WritePrivateProfileString(strsection$, UCase$(strkey$), strkeyvalue$, strfullpath$)
End Function
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 2nd, 2002, 03:19 PM
#5
Frenzied Member
James;
What are these 2 variables for?
Dim SharedExtensionsDir As String
Dim SharedExtensionsServer As String
-
Oct 2nd, 2002, 03:28 PM
#6
PowerPoster
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 2nd, 2002, 03:28 PM
#7
Frenzied Member
They're not, but you declare them.
-
Oct 2nd, 2002, 03:31 PM
#8
PowerPoster
Well
Ill be damned, left overs from something in the past, I suppose...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|