function createByteStructure() local size=4096 --In 6.3+ you can do: inputQuery("Create byte structure","Give the size in byte of the structure you wish to define","4096") if size~=nil then local name="Byte Struct "..size local s=createStructure(name) s.beginUpdate() local i for i=0,size-1 do local e=s.addElement() e.Offset=i e.Vartype=vtByte end s.endUpdate() s.addToGlobalStructureList() showMessage("The byte structure has been created. You can select it from the structures list now") --in 6.3 you can do: structureform.mainStruct=s end end function UpdateStructureForm(sender) --add a new menu item local i for i=1, #StructureFormList do local form=StructureFormList[i] local mi=createMenuItem(form.Menu) mi.Caption="Generator" form.Menu.Items.insert(2, mi) local miByte=createMenuItem(form.Menu) miByte.Caption="Byte structure" miByte.OnClick=createByteStructure mi.add(miByte) end StructureUpdateTimer.destroy() StructureUpdateTimer=nil StructureFormList={} --clear the list end function StructureDissectImprovement(form) if form.ClassName=="TfrmStructures2" then if StructureFormList==nil then StructureFormList={} end table.insert(StructureFormList, form) if StructureUpdateTimer==nil then StructureUpdateTimer=createTimer(nil) StructureUpdateTimer.Interval=1 StructureUpdateTimer.OnTimer=UpdateStructureForm StructureUpdateTimer.Enabled=true end end end registerFormAddNotification(StructureDissectImprovement)