>HSP-NEXTのサンプル蔵参照。
HSP-NEXTのサンプルは大きいアイコンと小さいアイコンの2種類の描き分けしかできませんでしたよね?
あのサンプルもExtractIconEx関数を使用しているので。
それとも私が見落としているのでしょうか?
>PrivateExtractIconsの使用方法について
とりあえず、HSP-NEXTのサンプルを改造したものを置いておきますね。
#module
;▼必要となるAPIや定数の定義
#uselib "user32.dll"
#func PrivateExtractIcons "PrivateExtractIconsA" int,int,int,int,int,int,int,int
#func DrawIconEx "DrawIconEx" int,int,int,int,int,int,int,int,int
#func DestroyIcon "DestroyIcon" int
#func InvalidateRect "InvalidateRect" int,var,int
#define LR_DEFAULTCOLOR $00000000
#define DI_NORMAL $00000003
; ・引数 sFile (str) : ファイル名文字列 or 文字列型変数
; nIndex (int) : 0〜(0) インデックス
; cx (int) : 0〜(16) 描画するアイコンの幅
; cy (int) : 0〜(16) 描画するアイコンの高さ
; nRedraw (int) : 0〜1(0) 再描画フラグ
#deffunc dispicon str prm1,int prm2,int prm3,int prm4,int prm5
mref bmscr,67
ls=strlen(prm1) : sdim sFile,ls+2
sFile = prm1 : if ls==0 : return -1
exist sFile : if strsize=-1 : return -1
nIndex = prm2 : if nIndex<=0 : nIndex=0
cx = prm3 : if cx<=0 : cx=16
cy = prm4 : if cy<=0 : cy=16
nRedraw= prm5 : if (nRedraw<=0)|(nRedraw>1) : nRedraw=0
;▼指定サイズのアイコンを取得
phicon= 0 : piconid= 0
PrivateExtractIcons varptr(sFile),nIndex,cx,cy,varptr(phicon),varptr(piconid),1,LR_DEFAULTCOLOR
if phicon=0 : return -1
if (piconid=0)|(piconid=$FFFFFFFF) {
DestroyIcon phicon
sdim sFile,0
return -1
} else {
;▼指定描画位置のみを描画、更新
DrawIconEx hdc,ginfo(22),ginfo(23),phicon,0,0,0,0,DI_NORMAL
if nRedraw==1 {
dim rc,4
rc.0 = bmscr(27)
rc.1 = bmscr(28)
rc.2 = bmscr(27)+cx
rc.3 = bmscr(28)+cy
InvalidateRect hWnd,rc,1
}
DestroyIcon phicon
sdim sFile,0
return 0
}
#global
;***** sample *****
;48x48サイズのアイコンを表示してみる。
dispicon dirinfo(3)+"\\shell32.dll",3,48,48,1
stop