$I CryptIni.inc
Def DateiName(1) SubStr$(@$(1),-1,"\\")
Def DateiPfad(1) Translate$(@$(1),("\\" + DateiName(@$(1))),"")
Var Programm$=Par$(If((Upper$(SubStr$(Par$(0), -1, "\\"))="PROFAN.EXE") or (Upper$(SubStr$(Par$(0), -1, "\\"))="XPROFAN.EXE"),1,0))
Var ini$=DateiPfad(Programm$) + "\\Highscore.ini"
CaseNot fileexists(ini$) : WriteRandomHighScores()

CLS
PassWord "INI-Passwort"
WindowTitle "Demo der CryptIni.inc - Copyright © 2012 by Julian Schmidt"
Var HighScores&=Create("ListBox", %hwnd, 0, 0, 0, width(%hwnd), height(%hwnd)-40)
Var Ende&=Create("Button",%hwnd,"Ende",width(%hwnd)-105,height(%hwnd)-37,100,35)
Var ReLoad&=Create("Button",%hwnd,"Neue Highscore-Liste generieren",5,height(%hwnd)-37,240,35)
ReadHighScores()

WhileNot iskey(27) or Getfocus(Ende&)
    Waitinput
    If Getfocus(ReLoad&)
        WriteRandomHighScores()
        ReadHighScores()
    EndIf
EndWhile

Proc WriteRandomHighScores
    Whileloop 10
        WriteCryptIni(ini$,"Platz",Str$(&loop),Str$(10000-(&loop*(950+RND(50)))))
    EndWhile
EndProc
Proc ReadHighScores
    ClearList HighScores&
    whileloop 10
        AddString(HighScores&," Platz "+Str$(&loop)+":\t  "+ReadCryptIni(ini$,"Platz",Str$(&loop)))
    Endwhile
EndProc
