#uselib "kernel32.dll"
#cfunc global WritePrivateProfileString "WritePrivateProfileStringA" sptr, sptr, sptr, sptr
#module
#defcfunc setini str file, str section, str key, str value, local s
s = section, key, value, file
return WritePrivateProfileString(s.0, s.1, s.2, s.3)
#deffunc delini str file, str section, str key, local s
s = section, key, file
if key = "" {
dummy = WritePrivateProfileString(s.0, 0, 0, s.2)
} else {
dummy = WritePrivateProfileString(s.0, s.1, 0, s.2)
}
return
#global
// INIファイル作成
dummy = 3, 5, 3, 4 // section総数, section1のkey数, section2のkey数, section3のkey数
fname = dir_cur + "\\" + "hspbc_tips.ini"
repeat dummy
i = cnt
repeat dummy(i + 1)
if setini(fname, "Section" + i, "Key" + cnt, "Data" + cnt) = 0 {
dialog "一時INIファイル作成に失敗しました"
end
}
loop
loop
// INIファイル構成
pos 10, 10 : mes "セクション"
pos 100, 10 : combox index.0, 100, "0\n1\n2"
pos 200, 10 : button gosub "削除", *deleteini
pos 10, 40 : mes "キー"
pos 100, 40 : combox index.2, 100, ""
pos 200, 40 : button gosub "削除", *deleteini
gosub *change
*main
wait 5
if index ! index.1 : gosub *change
goto *main
*change
index.1 = index
keyinfo = ""
repeat dummy(index + 1)
if keyinfo ! "" : keyinfo += "\n"
keyinfo += str(cnt)
loop
objprm 2, keyinfo
objprm 2, 0
return
*deleteini
if stat = 1 {
dialog "指定したセクションを丸ごと削除しますか?", 2
if stat = 6 : delini fname, "Section" + index, ""
} else {
dialog "指定したキーを削除しますか?", 2
if stat = 6 : delini fname, "Section" + index, "Key" + index.2
}
return
|