|
-
Nov 30th, 1999, 03:09 PM
#2
Lively Member
Heres a multistep example of the INI thingy u want... hope this helps 
Also I put Load & Save, Just in case 
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
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
'After adding that code make a command
'button, with the caption "save"
'Then add this code to it
Dim lngResult As Long
Dim strFileName
strFileName = "c:\test.ini"
lngResult = WritePrivateProfileString(txtHeading, _
txtKey.Text, txtValue.Text, strFileName)
If lngResult = 0 Then
'An error has occurred
Call MsgBox("An error has occurred", _
vbExclamation)
End If
'Now create another command button with the
'caption "Load". Heres the code for this...
Dim lngResult As Long
Dim strFileName
Dim strResult As String * 50
strFileName = "c:\test.ini"
lngResult = GetPrivateProfileString(txtHeading, _
txtKey, strFileName, strResult, Len(strResult), _
strFileName)
If lngResult = 0 Then
'An error has occurred
Call MsgBox("An error has occurred", _
vbExclamation)
Else
txtValue.Text = Trim(strResult)
End If
Hope this helps!
-Justin =]
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
|