>fortunehillさん
ご回答ありがとうございます。
http://lhsp.s206.xrea.com/hsp_object6.html#1
こちらのタブコントロール用のモジュールにイメージを
設定してみたのですが変化がありませんでした。
Delphiは初めて見たので読み間違えたのかもしれませんが。
それから、タブのアイコンのクリック判定ってできるものなのでしょうか?
#uselib "comctl32.dll"
#cfunc ImageList_Create "ImageList_Create" sptr,sptr,sptr,sptr,sptr
#func ImageList_AddIcon "ImageList_AddIcon" sptr,sptr
#uselib "user32.dll"
#cfunc LoadIcon "LoadIconA" sptr,sptr
/************追加****************/
#define global ILC_COLOR 0x0000
#define global ILC_COLOR4 0x0004
#define global ILC_COLOR8 0x0018
#define global ILC_COLOR16 0x0010
#define global ILC_COLOR24 0x0018
#define global ILC_COLOR32 0x0020
#define global ILC_COLORDDB 0x00FE
#define global ILC_MASK 0x0001
#define TCM_SETIMAGELIST 0x1303
/*********************************/
#module
#uselib "user32"
#func GetClientRect "GetClientRect" int, int
#func SetWindowLong "SetWindowLongA" int, int, int
#func SetParent "SetParent" int, int
#uselib "gdi32"
#cfunc GetStockObject "GetStockObject" int
; CreateTab p1, p2, p3, p4
; タブコントロールを設置します。statにタブコントロールのハンドルが
; 返ります。
; p1〜p2=タブコントロールのX/Y方向のサイズ
; p3(1)=タブの項目として貼り付けるbgscr命令の初回ウィンドウID値
; p4=タブコントロールの追加ウィンドウスタイル
#deffunc CreateTab int p1, int p2, int p3, int p4
winobj "systabcontrol32", "", , $52000000 | p4, p1, p2
hTab = objinfo(stat, 2)
sendmsg hTab, $30, GetStockObject(17)
TabID = p3
if TabID = 0 : TabID = 1
dim rect, 4
return hTab
; InsertTab "タブつまみ部分の文字列"
; タブコントロールに項目を追加します。
#deffunc InsertTab str p2
pszText = p2 : tcitem = 1, 0, 0, varptr(pszText)
sendmsg hTab, $1307, TabItem, varptr(tcitem)
GetClientRect hTab, varptr(rect)
sendmsg hTab, $1328, , varptr(rect)
bgscr TabID + TabItem, rect.2 - rect.0, rect.3 - rect.1, 2, rect.0, rect.1
SetWindowLong hwnd, -16, $40000000
SetParent hwnd, hTab
TabItem++
return
#deffunc ChangeTab
gsel wID + TabID, -1
sendmsg hTab, $130B
wID = stat
gsel wID + TabID, 1
return
#global
screen , 400, 300
syscolor 15 : boxf
pos 50, 50
CreateTab 300, 200, 1
hTabControl = stat
InsertTab "AAA"
pos 50, 50 : mes "A"
InsertTab "BBB"
pos 50, 50 : mes "B"
InsertTab "CCC"
pos 50, 50 : mes "C"
InsertTab "DDD"
pos 50, 50 : mes "D"
gsel 1, 1
gsel
/************追加****************/
hIM = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 4, 0) ;イメージリスト生成
repeat 4
ImageList_AddIcon hIM, LoadIcon(0, 32512+cnt) ;イメージリストに適当に追加
loop
sendmsg hTabControl, TCM_SETIMAGELIST, 0, hIM ;メッセージ送信
/********************************/
oncmd gosub *notify, $4E
stop
; タブ項目切り替え処理部分です。
*notify
dupptr nmhdr, lparam, 12
if nmhdr.0 = hTabControl & nmhdr.2 = -551 {
ChangeTab
gsel
}
return