2007年5月14日月曜日

ツリービュー

ツリービューを作成する。


#include "comctl32.as"
#include "user32.as"

#define global TVM_INSERTITEM    0x1100
#module
#deffunc makeTree int _width, int _height
    initCCEx = 80x00000002
    InitCommonControlsEx varptr(initCCEx)
    style = 0x40000000 | 0x10000000 | 0x0001 | 0x0002 | 0x0200
    CreateWindowEx 0"SysTreeView32""", style, ginfo_cxginfo_cy, _width, _height, hWnd000
    hTree = stat
    return hTree

#deffunc addTree str text, int hParent
    dim tvins, 12
    bufText = text
    hIns = 0xFFFF0002                   // TVI_LAST
    tvins = hParent, hIns, 0x0001       // 親アイテムのハンドル、挿入位置のアイテムハンドル、TVIF_TEXT
    tvins(6) = varptr(bufText), strlen(bufText)
    sendmsg hTree, TVM_INSERTITEM0varptr(tvins)
    return stat
#global

    boxf
    makeTree 240480
    addTree "sample1"0
    addTree "sample1の子供"stat
    addTree "sample2"0
    addTree "sample2の子供"stat
    addTree "sample2の孫"stat
    stop

0 件のコメント: