ll_libload kernel, "kernel32.dll"
ll_getproc SetLocalTime, "SetLocalTime", kernel
#module
#deffunc tm2st val, int, int, int, int, int, int, int
mref tm, 48 : mref y, 1 : mref m, 2 : mref d, 3 : mref h, 4 : mref mi, 5 : mref s, 6 : mref ms, 7
if y = 0 : gettime y, 0
if m = 0 : gettime m, 1
if d = 0 : gettime d, 3
if h = 0 & (mi = 0) & (s = 0) & (ms = 0) : gettime h, 4 : gettime mi, 5 : gettime s, 6 : gettime ms, 7
wpoke tm.0, 0, y
wpoke tm.0, 2, m
wpoke tm.1, 2, d
wpoke tm.2, 0, h
wpoke tm.2, 2, mi
wpoke tm.3, 0, s
wpoke tm.3, 2, ms
return
#deffunc settime int, int, int, int, int, int, int
mref y, 0 : mref m, 1 : mref d, 2 : mref h, 3 : mref mi, 4 : mref s, 5 : mref ms, 6
mref stt, 64
dim st, 4
tm2st st, y, m, d, h, mi, s, ms
ll_getptr st : ll_ret prm
ll_callfunc prm, 1, SetLocalTime@
ll_ret prm : stt = prm
return
#global
dim now, 8
pos 10, 10 : input now.0, 40, 20, 4
pos 75, 10 : input now.1, 25, 20
pos 120, 10 : input now.3, 25, 20
pos 170, 10 : input now.4, 25, 20
pos 220, 10 : input now.5, 25, 20
pos 270, 10 : input now.6, 25, 20
pos 350, 10 : button "変更", *set
pos 420, 10 : button "取得", *get
pos 50, 13 : mes "年 月 日 時 分 秒"
*get
repeat 7 : gettime now.cnt, cnt : loop
repeat 6 : i = cnt + (cnt >= 2) : objprm cnt, now.i : loop
stop
*set
settime now.0, now.1, now.3, now.4, now.5, now.6
if stat : dialog "変更しました" : else : dialog "変更に失敗しました", 1
stop
|