#SingleInstance,Force Gui,+hwndhwnd Gui,Add,TreeView,w400 h200 Checked list:=[] Loop,2 ;not necessary { id:=TV_Add("This option will not have a checkbox") TV_Add("This option will have a checkbox") list.insert(id) ;insert the id into the array list } Gui,Show,,Hide Checkboxes VarSetCapacity(tvitem,28) for index,id in list{ ;loop through the array of id numbers info:=A_PtrSize=4?{0:8,4:id,12:0xf000}:{0:8,8:id,20:0xf000} ;there are 2 different offsets for x32 and x64. This will account for both for offset,value in info NumPut(value,tvitem,offset) SendMessage,4415,0,&tvitem,SysTreeView321,ahk_id%hwnd% ;4415 is tvm_setitemw which is tv_first=0x1100 + 63 } return GuiClose: GuiEscape: ExitApp return
Feedback is always welcome.