Hi David;
Roland has the correct reply & suggestion.
You can see this feature at work in my framework. Its called the "Window Manager" service and it tracks all open windows regardless of their type. The WM is automatic and hidden and yo do not have to program for it like a PFC service. Not only can you see the open windows at any time ..
Native:
Dockable:
WEB
The framework uses the "Window Manager" service to close all open windows in the exact "reverse" order they were opened when a "Close All" request is made or the App is closing down altogether. The App Manager also produces Window (and its associated Menu) usage stats upon closure. ;-)
Feel free to check out how this works in the STD Integrated Framework's example OrderEntry Demo App ...
https://sourceforge.net/projects/stdfndclass/files/Applications/PowerBuilder/OrderEntry
HTH
Regards ... Chris
PS: This feature works in all Native, PowerServer Web / Mobile, and IWA deployed PB Apps. Also, the framework is free and fully open sourced - so feel free to use this free framework or borrow this code for your framework and/or App directly.
How many windows do you have?
It's just a matter of creating an ancestor window, let's say w_master and then editing the source code replacing "from window" with "from w_master".
You could even export all windows and then use notepad++ to do a "find and replace in files".
After that, you'd only have to re-import the modified exported code.