;` This code was downloaded from The Game Creators ;` It is reproduced here with full permission ;` http://www.thegamecreators.com ;`Title: INI file functions ;`Version: 2.0 ;`Developer: Unknown (re-coded by Genesis Rage) ;`Date: 10-22-2003 ;` ;`Email: ceo@genesisrage.com ;`Web: http://genesisrage.com ;` ;`History: ;` 2.0 code completely re-done, got from forums actually, just spreading the wealth! ;` And this also comes complete with help files... If you download the file! ;` 1.3 fixed bug that would not Return Default value If key was not found ;` 1.2 Optimized INI_ReadValue ;` 1.1 Fixed bug, no longer searches after value has been found ;` 1.0 Initial release (only Read capabilities) ;` ;`Example Usage: ;` Return String = INI_ReadString("config","Section","Key","Default Value") ;` Return Integer Or Float = INI_ReadInteger("config","Section","Key",1458) ;` INI_WriteSring("config","Section","Key","Value") ;` INI_WriteInteger("config","Section","Key",500); ;` ;`Info: ;` the file path is generated from you current directory 'get dir$()' so change directory If file ;` is located elsewhere. Do NOT change the FileName arguments in this code, Win 2k And Win XP must ;` have FULL PATH NAME To Read Or write the file. ;` ;` You MUST load the DLL, either manually Or by using 'InitialiseKernel32DLL()' function. The Default ;` number in THIS code is '203' If you change it, make sure To update the rest of the code.; ;`modified by norm July 2005 ;`To improve genericness ;`but, now requires MediaMan.dba ;`And text.dba ;`also modified To match DBC113E ;ported to PB Dec 2005 by Norm ;to replace the PB stuff which has issues ... ;`Dim LastDLL(1) ;`Dim Kernel132(1) ;`Dim IniFile$(1) ;the good part is much of the stuff is not needed ;function LoadINI() ; If Kernel132(1) ; If dll exist(Kernel132(1))=0 then load dll "kernel132.dll",Kernel132(1) ; Else ; Kernel132(1)=loaddll("kernel32.dll") ; EndIf ;endfunction ;function CloseINI() ; If Kernel132(1) ; If dll exist(Kernel132(1)) then delete dll Kernel132(1) ; EndIf ;endfunction Global IniFile.s Procedure.s INI_ReadString( Section$, KeyName$, DS.s) r$=Space(120) GetPrivateProfileString_( Section$, KeyName$, DS, r$, Len(r$), IniFile ) ;`If KeyName$="Idle" then debugpause(r$) r$=Trim(r$) ;`debugpause(r$) ;r$=RTrim$(r$) ;`debugpause(r$) ProcedureReturn r$ EndProcedure Procedure INI_WriteString( Section$, KeyName$, Value$) WritePrivateProfileString_( Section$, KeyName$, Value$, IniFile ) EndProcedure Procedure.l INI_ReadInteger( Section$, KeyName$, D.l ) r.l=Val( INI_ReadString( Section$, KeyName$, Str(D))) ProcedureReturn r EndProcedure Procedure.f INI_ReadFloat( Section$, KeyName$, F.f ) AF.f=ValF(INI_ReadString( Section$, KeyName$, Str(F))) ProcedureReturn AF EndProcedure Procedure INI_WriteInteger( Section$, KeyName$, Value.l) INI_WriteString( Section$, KeyName$, Str(Value)) EndProcedure Procedure.l INI_Inc(Section$,KeyName$) old.l=INI_ReadInteger(Section$,KeyName$,0)+1 INI_WriteInteger(Section$,KeyName$,old) ProcedureReturn Old EndProcedure ; ExecutableFormat=Windows ; EOF