I am aware of that windows memory story. But this looks more like a PB issue, if you run the following code that uses a pure api container and does not use BindEvent() the memory stays at 1.4MB rock solid, it never goes past that no matter how heavily you resize the window for any amount of time.
I would say is some event data or drawing object not being released, maybe is inherent to windows memory management or to PB. Not a big problem because the memory is released when the resizing ends, but it is something Fred could look at.
Code: Select all
EnableExplicit
#CONT_CLASS = "mycont"
Global.i hwCont
Declare on_size()
Procedure contProc(hwnd.i, msg.l, wparam.i, lparam.i)
Select msg
Case #WM_PAINT
Protected.PAINTSTRUCT ps
Protected.i hdc, hbr
hdc = BeginPaint_(hwnd, @ps)
hbr = CreateSolidBrush_(RGB(255, 0, 0))
FillRect_(hdc, @ps\rcPaint, hbr)
DeleteObject_(hbr)
EndPaint_(hwnd, @ps)
ProcedureReturn 0
EndSelect
ProcedureReturn DefWindowProc_(hwnd, msg, wparam, lparam)
EndProcedure
Procedure wnd_proc(hwnd.i, msg.l, wparam.i, lparam.i)
Select msg
Case #WM_SIZE
; on_size()
MoveWindow_(hwCont, 0, 0, DesktopScaledX(WindowWidth(0)), DesktopScaledY(WindowHeight(0)), #True)
ProcedureReturn 0
EndSelect
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
Procedure registerClass()
Protected.WNDCLASS wc
Protected.s className
className = #CONT_CLASS
wc\hInstance = GetModuleHandle_(0)
wc\lpfnWndProc = @contProc()
wc\style = #CS_HREDRAW | #CS_VREDRAW
wc\lpszClassName = @className
RegisterClass_(@wc)
EndProcedure
Procedure on_size()
; ResizeGadget(1, 0, 0, WindowWidth(0) / 2, WindowHeight(0) / 2)
; ResizeGadget(2, WindowWidth(0) / 2, 0, WindowWidth(0) / 2, WindowHeight(0) / 2)
; ResizeGadget(3, 0, WindowHeight(0) / 2, WindowWidth(0) / 2, WindowHeight(0) / 2)
; ResizeGadget(4, WindowWidth(0) / 2, WindowHeight(0) / 2, WindowWidth(0) / 2, WindowHeight(0) / 2)
; ResizeGadget(5, 0, 0, WindowWidth(0), WindowHeight(0))
MoveWindow_(hwCont, 0, 0, DesktopScaledX(WindowWidth(0)), DesktopScaledY(WindowHeight(0)), #True)
EndProcedure
registerClass()
OpenWindow(0, 10, 10, 600, 400, "Test", #PB_Window_SizeGadget | #PB_Window_MaximizeGadget | #PB_Window_MinimizeGadget | #PB_Window_SystemMenu)
; BindEvent(#PB_Event_SizeWindow, @on_size())
hwCont = CreateWindowEx_(0, #CONT_CLASS, "", #WS_CHILD | #WS_VISIBLE, 0, 0, 0, 0, WindowID(0), 0, GetModuleHandle_(0), 0)
; ContainerGadget(1, 0, 0, 0, 0)
; CloseGadgetList()
; ContainerGadget(2, 0, 0, 0, 0)
; CloseGadgetList()
; ContainerGadget(3, 0, 0, 0, 0)
; CloseGadgetList()
; ContainerGadget(4, 0, 0, 0, 0)
; CloseGadgetList()
;
; SetGadgetColor(1, #PB_Gadget_BackColor, RGB(255, 0, 0))
; SetGadgetColor(2, #PB_Gadget_BackColor, RGB(0, 255, 0))
; SetGadgetColor(3, #PB_Gadget_BackColor, RGB(0, 0, 255))
; SetGadgetColor(4, #PB_Gadget_BackColor, RGB(255, 0, 255))
SetWindowCallback(@wnd_proc())
; ButtonGadget(5, 0, 0, 0, 0, "Test")
on_size()
Repeat
Until WaitWindowEvent() = #PB_Event_CloseWindow