ll_libload user, "user32.dll"
ll_getproc DestroyIcon, "DestroyIcon", user
ll_getproc DrawIconEx, "DrawIconEx", user
ll_getproc GetSystemMetrics, "GetSystemMetrics", user
ll_libload shell, "shell32.dll"
ll_getproc ExtractIconEx, "ExtractIconEx", shell
#module
#deffunc gsm int
mref i, 0
mref stt, 64
ll_callfunc i, 1, GetSystemMetrics@
ll_ret i : stt = i
return
#deffunc geticonnum str
mref file, 32
mref stt, 64
ll_getptr file : ll_ret prm
prm.1 = 0, 0, 0, -1
ll_callfunc prm, 5, ExtractIconEx@ : ll_ret prm
stt = prm
return
#deffunc drawicons str, int, int, int, int, int, int
mref file, 32 : mref num, 1 : mref ix, 2 : mref iy, 3 : mref sx, 4 : mref sy, 5 : mref small, 6
mref stt, 64
mref bmscr, 67
j = csrx, csry, 0, csrx, csry
geticonnum file : j.2 = stat
dim h, j.2
ll_getptr h : ll_ret i
prm = 0, 0, (small = 0) * i, (small ! 0) * i, j.2
ll_getptr file : ll_ret prm
ll_callfunc prm, 5, ExtractIconEx@
if num < 1 : num = 1
if sx = 0 {
if small : gsm 0x0031 : else : gsm 0x000B // (small) SM_CXSMICON (big) SM_CXICON
sx = stat
}
if sy = 0 {
if small : gsm 0x0032 : else : gsm 0x000C // (small) SM_CYSMICON (big) SM_CYICON
sy = stat
}
if ix < 0 : gsm 0x0026 : ix = stat // SM_CXICONSPACING
if iy < 0 : gsm 0x0027 : iy = stat // SM_CYICONSPACING
repeat j.2
j.3 += sx + ix
prm = bmscr.4, j.3, j.4, h.cnt, sx, sy, 0, 0, 0x0003
ll_callfunc prm, 9, DrawIconEx@
ll_callfunc h.cnt, 1, DestroyIcon@
if cnt \ num = (num - 1) : j.3 = j.0, j.4 + sy + iy
loop
redraw 1
stt = j.2
return
#global
columns = 3
dialog "", 16, "描画アイコン"
if stat {
pos 50, 50
drawicons refstr, columns, 10, 5 // 横に3個、横間隔10・縦間隔5ピクセルで並べる
dialog "" + stat + "個のアイコンを描画しました"
}
stop
|