Sub Item_Group.Destroy() ID = "" : Title = "" DestroyWindow(whwnd) DeleteObject(FontBrush) whwnd = 0 : FontColor = 0 FontBKColor = 0 : FontBrush = 0 End Sub 'Groupbox Function CreateGroupBox(byref ItemHandle as Item, byval px as integer, byval py as integer, byval w as integer, byval h as integer, byval title as string = "", byval FontColor as Integer = &h000000, byval FontBkColor as Integer = TRANSPARENT) as Item Dim as UInteger ExStyle = WS_EX_LEFT OR WS_EX_LTRREADING OR WS_EX_NOPARENTNOTIFY OR WS_EX_TOPMOST OR WS_EX_NOINHERITLAYOUT OR WS_EX_CONTROLPARENT OR WS_EX_TRANSPARENT Dim as UInteger Style = WS_CHILD OR WS_VISIBLE OR BS_GROUPBOX OR WS_GROUP OR WS_CLIPSIBLINGS OR WS_CLIPCHILDREN 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_Group ptr group = NEW Item_Group group -> whwnd = CreateWindowEx( ExStyle, "BUTTON", title, Style, rx, ry, w, h, _ phwnd, Cast(HMENU,123), Globals.hInstance, 0) If (group = 0) Then LOGSTRING(Time & " | ERROR | Failed to create " & GroupBoxID & " " & title) MessageBox(NULL,"Failed to create " & GroupBoxID & " " & title, "Error", NULL) Delete group Return NULL End If SendMessage(group -> whwnd, WM_SETFONT, Cast(WPARAM, Globals.hFont), Cast(LPARAM,TRUE)) SetWindowLongPtr(group -> whwnd, GWLP_USERDATA, cast(LONG_PTR,group)) group -> ID = GroupBoxID group -> Title = title group -> FontColor = Convert_RGB_To_BGR(FontColor) group -> FontBKColor = TRANSPARENT If FontBKColor<>TRANSPARENT Then group -> FontBKColor = Convert_RGB_To_BGR(FontBKColor) group -> FontBrush = CreateSolidBrush(group -> FontBKColor) End If LOGSTRING(Time & " | INFO | " & GroupBoxID & " " & title & " created on " & ItemHandle -> ID & " " & ItemHandle -> Title & ".") Globals.ItemList.AddItem(group) return group End Function