Structs Question

new topic     » topic index » view thread      » older message » newer message

Hello,

This regards structs in Windows

I need help with the 2nd line

 tvinsert.hInsertAfter,TVI_ROOT
 tvinsert.item.imask,TVIF_TEXT

item obviously is in the form tvinsert[0], tvinsert[1] etc
like sequence operations in eu.

I cant figure out how to do this, I looked at win32lib
and found how it's put together there but it just seems
odd.

Does anyone have a quick fix for this?

Below is some code that might help you help me.

</snip>

hImageList = c_func(xImageList_Create,{16,16,ILC_COLOR16,2,10})

hBitmap = LoadImage("list.bmp", IMAGE_BITMAP)
junk = c_func(xImageList_Add,{hImageList,hBitmap,NULL})
c_proc(xDeleteObject, {hBitmap})

junk = c_func(SendMessage,{TreeView1,TVM_SETIMAGELIST,0,hImageList})

tvstruct = allocate_struct( SIZEOF_tvstruct )
tvinsert = allocate_struct( SIZEOF_TVITEM )

poke4( tvstruct + TVINSERTSTRUCT_hParent,NULL)
poke4( tvstruct + TVINSERTSTRUCT_hInsertAfter,TVI_ROOT)

--item = peek( {1, SIZEOF_TVITEM})
--poke( tvstruct + TVINSERTSTRUCTITEM_mask[1], item )

poke4( tvinsert + TVITEM_mask,or_all({TVIF_TEXT+TVIF_IMAGE+TVIF_SELECTEDIMAGE}))

Parent = allocate_string("Parent Item")
poke4( tvinsert + TVITEM_pszText,Parent)
poke4( tvinsert + TVITEM_iImage,0)
poke4( tvinsert + TVITEM_iSelectedImage,1)
free(Parent)

hParent = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct})
poke4( tvstruct + TVINSERTSTRUCT_hParent,hParent)
poke4( tvstruct + TVINSERTSTRUCT_hInsertAfter,TVI_LAST)

Child1 = allocate_string("Child One")
poke4(tvinsert + TVITEM_pszText,Child1)
junk = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct})
free(Child1)

Child2 = allocate_string("Child Two")
poke4(tvinsert + TVITEM_pszText,Child2)
junk = c_func(SendMessage,{TreeView1,TVM_INSERTITEM, 0, tvstruct})
free(Child2)

free(tvinsert)
free(tvstruct)

<snip\>

TIA,

Euman
euman at bellsouth.net

new topic     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu