Type Item_Check EXTENDS Item_Node Declare Sub Destroy() End Type Sub Item_Check.Destroy() ID = "" : Title = "" DestroyWindow(whwnd) whwnd = 0 End Sub Function CreateCheckBox(byref ItemHandle as Item, byval px as Integer, byval py as Integer, byval txt as String="") as Item Dim as UInteger ExStyle = WS_EX_TRANSPARENT Dim as UInteger Style = WS_VISIBLE OR WS_CHILD OR WS_CLIPSIBLINGS OR WS_TABSTOP OR BS_AUTOCHECKBOX If (ItemHandle = 0) Then return NULL Dim as RECT prect Dim as HWND phwnd Dim as Integer rx, ry If (ItemHandle -> ID = WindowID) Then phwnd = ItemHandle -> whwnd rx = px : ry = py ElseIf (ItemHandle -> ID = GroupBoxID) Then phwnd = GetParent(ItemHandle -> whwnd) GetClientRect(ItemHandle -> whwnd, @prect) MapWindowPoints(ItemHandle -> whwnd, phwnd, Cast(LPPOINT, @prect),2) rx = prect.left + px : ry = prect.top + py Else LOGSTRING(Time & " | ERROR | Parent is not an valid Item.") Return NULL End If Dim as Item_Check ptr newCheckBox = new Item_Check Dim as SIZE cSIZE Dim as HDC cDC = GetDC(phwnd) Dim as String dtxt = " "+txt GetTextExtentPoint32(cDC,dtxt,len(txt),@cSIZE) If cSIZE.cy<15 Then cSize.cy=15 newCheckBox -> whwnd = CreateWindowEx(NULL, "BUTTON", txt, Style, rx, ry, 30+cSIZE.cx, cSIZE.cy, phwnd, NULL, Globals.hInstance, newCheckBox) If (NewCheckBox -> whwnd = 0) Then Delete newCheckBox LOGSTRING(Time & " | ERROR | Failed to create " & CheckBoxID) MessageBox(NULL,"Failed to create " & CheckBoxID, "Error", NULL) Return NULL End If SendMessage(newCheckBox -> whwnd, WM_SETFONT, Cast(WPARAM, Globals.hFont), Cast(LPARAM,TRUE)) SetWindowLongPtr(newCheckBox -> whwnd, GWLP_USERDATA, Cast(LONG_PTR, newCheckBox)) newCheckBox -> ID = CheckBoxID newCheckBox -> Title = txt LOGSTRING(Time & " | INFO | " & CheckBoxID & " " & newCheckBox -> Title & " created on " & ItemHandle -> ID & " " & ItemHandle -> Title & ".") Globals.ItemList.AddItem(newCheckBox) return newCheckBox End Function Function GetCheckBoxState(byref CheckBox as Item) as Integer If CheckBox = 0 orelse CheckBox -> ID <> CheckBoxID Then return NULL If (SendMessage(CheckBox -> whwnd, BM_GETCHECK, 0, 0) = BST_CHECKED) Then return TRUE return FALSE End Function Sub SetCheckBoxState(byref CheckBox as Item, byval State as Integer) If CheckBox andalso CheckBox -> ID = CheckBoxID Then If State Then SendMessage(CheckBox -> whwnd, BM_SETCHECK, BST_CHECKED,0) Else SendMessage(CheckBox -> whwnd, BM_SETCHECK, BST_UNCHECKED,0) End If End If End Sub