ll_libload kernel, "Kernel32.dll"
ll_getproc SetFileAttributes, "SetFileAttributesA", kernel
#module
#deffunc setattribute str, int
mref file, 32 : mref type, 1
mref stt, 64
ll_getptr file : ll_ret prm
prm.1 = type
ll_callfunc prm, 2, SetFileAttributes@
ll_ret prm : stt = prm
return
#global
sdim file, 256
sdim atrname, 16, 7
atr = 0x0001, 0x0002, 0x0004, 0x0020, 0x0100, 0x1000, 0x2000
atrname = "読取専用", "隠し", "システム", "アーカイブ", "一時", "オフライン", "高速検索対象外"
pos 10, 10 : input file, 240, 20
pos 250, 10 : button "読込", *load
pos 10, 40 : button "設定", *change
objsize 180, 20
repeat 7
pos 10, cnt * 30 + 80 : chkbox atrname.cnt + "属性", type.cnt
loop
stop
*load
dialog "", 16, "属性を設定するファイル"
if stat : objprm 0, refstr
stop
*change
i = 0
repeat 7
if type.cnt : i += atr.cnt
loop
if i = 0 : i = 0x0080 // 全てにチェックがないなら無属性(FILE_ATTRIBUTE_NORMAL)
setattribute file, i
if stat : s = "" : else : s = "に失敗"
dialog "設定" + s + "しました"
stop
|