Page 1 of 1

(Solved in 6.10) Close a minimized window (Win)

Posted: Wed Apr 03, 2024 6:35 pm
by ChrisR
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.

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

Re: Close a minimized window (Win)

Posted: Wed Apr 03, 2024 7:01 pm
by Caronte3D
Wow! :shock:
You found a problem on my code related to close a window from the bar when the window is minimized.

We never do things the same as the users of our applications :D

I hate bugs :evil:

BTW, Thanks! :P

Re: Close a minimized window (Win)

Posted: Wed Apr 03, 2024 8:03 pm
by HeX0R
I couldn't recreate this, only with older PB versions (prior to 6.10).
Did you try this with the latest version?

Re: Close a minimized window (Win)

Posted: Wed Apr 03, 2024 8:57 pm
by ChrisR
Ha, you're right, it's good now with v6.10. It wasn't the case with previous versions.
I haven't switched yet, I'm still on 6.04 installed and 6.10 available in portable mode.
No need to ask for Feature Requests and Wishlists anymore, Fred and Timo, anticipate them in advance, Great :)

Re: (Solved in 6.10) Close a minimized window (Win)

Posted: Wed Apr 03, 2024 11:11 pm
by skywalk
Thanks for post. Did not know this was fixed.