felipEx
Scripting Contest Winner
Posts: 378 Reputation: 24
35 / /
Joined: Jun 2006
|
RE: [Request] Read, write and delete from/to ini file
try this
code: function DeleteHeader(path, header){
Interop.Call('kernel32', 'WritePrivateProfileSectionW', header.toString(), 0, path )
}
function DeleteKey(path, header, key){
Interop.Call('kernel32', 'WritePrivateProfileStringW', header.toString(), key.toString(), 0, path)
}
function WriteIni(path, header, key, value){
Interop.Call('kernel32', 'WritePrivateProfileStringW', header.toString(), key.toString(), value.toString(), path);
}
function ReadIni(path, header, key, default_value){
var cRetVal = Interop.Allocate(2 * (256 + 1) );
var lTmp = Interop.Call('kernel32','GetPrivateProfileStringW', header, key.toString(), default_value.toString(), cRetVal, cRetVal.Size, path);
return lTmp == 0 ? default_value : cRetVal.ReadString(0);
}
|
|