INIfile$ = DefaultDir$ + "\test.ini"
calldll #kernel32, "WritePrivateProfileStringA", "MyApp" as ptr, _
"MyKey" as ptr, "MyString" as ptr, INIfile$ as ptr, ret as long
' delete entry:
calldll #kernel32, "WritePrivateProfileStringA", "MyApp" as ptr, _
"MyKey" as ptr, _NULL as long, INIfile$ as ptr, ret as long
' delete section:
calldll #kernel32, "WritePrivateProfileStringA", "MyApp" as ptr, _
_NULL as long, _NULL as long, INIfile$ as ptr, ret as long
function WriteINI(section$,entry$,string$,filename$)
CallDLL #kernel32, "WritePrivateProfileStringA", _
section$ As ptr, _
entry$ As ptr, _
string$ As ptr, _
filename$ As ptr, _
result As long
WriteINI = result
end function
FileName$ = "strangeFile.ini" 'see: no path
Section$="sect1"
Entry$="user"
String$="John Doe"
result=0
calldll #kernel32, "WritePrivateProfileStringA", _
Section$ as ptr, _ 'section name
Entry$ as ptr, _ 'entry name
String$ as ptr, _ 'actual entry
FileName$ as ptr, _ 'name of ini file
result as long
print "result=";result