#uselib "kernel32.dll"
#cfunc global WritePrivateProfileString "WritePrivateProfileStringA" sptr, sptr, sptr, sptr
#func global GetPrivateProfileString "GetPrivateProfileStringA" sptr, sptr, sptr, var, int, 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)
#defcfunc getini str file, str section, str key, str defvalue, int maxsize, local s
sdim s, maxsize, 5
s = section, key, defvalue, "", file
GetPrivateProfileString s.0, s.1, s.2, s.3, maxsize, s.4
return s.3
#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 10, 40 : mes "キー"
pos 100, 40 : combox index.2, 100, ""
pos 100, 70 : button gosub "読込", *getvalue
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 1, keyinfo
index.2 = 0
objprm 1, index.2
return
*getvalue
dialog getini(fname, "Section" + index, "Key" + index.2, "存在しません", 16)
return
|