blur - it sounds like you're taking a bunch of stabs in the dark here, but just FYI, there's no need to guess! There's extensive documentation:
* The Javscript scripting section in the help is the umbrella section everything's organized under
* For places where you want to call Windows system APIs (such as FindWindow), see Javascript scripting > Calling Native DLLs from Javascript
* For operations on windows (the small "w" kind) in general, see Javascript scripting > Window Objects, and Javascript scripting > Window Objects > backglassWindow for the backglass window in particular. Under Window objects, you'll find that you can minimize a window like this:
backglassWindow.setWindowState("min")
With that information, you might try the "minimize" approach again and see if that works. But really, the send-to-background approach should have worked in the first place - PinballY should have automatically reinstated the window when the game exited. When you say it's no longer full-screen, do you mean it moved/changed size, or something else?
[edit] Hang on, reading the documentation, I see that <windowObject>.setWindowPos() says: "First, if the window is currently in full-screen mode, it's switched to normal windowed mode." So there's why it's coming out of full-screen mode. So you just have to set it back after the game exits. Perhaps this (untested):
let backglassWasFullScreen = false;
mainWindow.on("gamestarted", ev => {
if (backglassWindow.hwndFrame.isVisible()) {
backglassWasFullScreen = backglassWindow.fullScreenMode;
backglassWindow.setWindowPos(HWND.BOTTOM, 0, 0, 0, 0, SWP_NOACTIVATE | SWP_NOMOVE | SWP_NOSIZE | SWP_NOOWNERZORDER);
}
});
mainWindow.on("gameover", ev => {
if (backglassWasFullScreen)
backglassWindow.fullScreenMode = true;
});
Hi MJR.......thanks for your advice in this thread. I really really think I've figured my issue out now; B2STableSettings.xml needs to have the following line added near the top: <FormToFront>1</FormToFront>. This brings the B2S BG to the top and let's me capture the BG within PBY. I thought I would leave this here in case anyone down the line runs into the same issue.......
Great, glad you found a solution! Sounds like you ran into the same thing as blur, in a slightly different form. This sounds like a good thing to add to the troubleshooting section. Or maybe PinballY should just start sending the BG to the background by itself, given that B2S seems to be intentionally bringing itself up in back by default (which B2S is undoubtedly doing as a by-design workaround for the VPM DMD window layering issue that blur has).
Edited by mjr, 02 December 2019 - 06:51 PM.