(Solved in 6.10) Close a minimized window (Win)
Posted: Wed Apr 03, 2024 6:35 pm
Is it possible to send the #PB_Event_CloseWindow event when closing a minimized window, via right-click and close option from the taskbar context menu.
I'm currently bypassing it using a Callcack, it would be good to have it native to get this default behavior.
I'm currently bypassing it using a Callcack, it would be good to have it native to get this default behavior.
Code: Select all
; Required to receive the #PB_Event_CloseWindow event, when the window is minimized and closed from the taskbar (right-click)
Procedure WinCallback(hWnd, uMsg, wParam, lParam)
If uMsg = #WM_CLOSE
PostEvent(#PB_Event_Gadget, GetDlgCtrlID_(hWnd), 0, #PB_Event_CloseWindow)
EndIf
ProcedureReturn #PB_ProcessPureBasicEvents
EndProcedure
If OpenWindow(0, 0, 0, 340, 180, "Close minimized window", #PB_Window_SystemMenu|#PB_Window_MinimizeGadget|#PB_Window_MaximizeGadget|#PB_Window_SizeGadget|#PB_Window_ScreenCentered)
TextGadget(0, 40, 60, 260, 60, "Minimize the window and close it using the Close option in the taskbar context menu (right-click).", #PB_Text_Center)
;SetWindowCallback(@WinCallback(), 0) ; Uncomment to receive the #PB_Event_CloseWindow event
Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow
Debug "#PB_Event_CloseWindow Event received"
EndIf