Hi mjr - thanks for the quick response and for trying that. I am using Windows 7 64-bit. I use the latest nVidia drivers for a GTX 970. Thanks
P.S. Not sure if it's relevant but in PBY as a test I used two standard alphabetical keys for the pause button and exit button, just in case there was a conflict in the way VPX implements ESC. But I got the same behaviour.
The choice of keys shouldn't make any difference to PinballY, but it was a good test to try different keys just in case it was a conflict on the VP side or somewhere else.
So, the way that Windows 8 handles task switching from full-screen applications is to minimize the full-screen window. That seems to be something that the OS does automatically as soon as you switch to another program. But program switching is controlled by Windows itself, and it doesn't always allow a background task to take control - the rules for that are complex and aren't documented precisely; they're kind of vague and hand-wavy about it in the API docs, like the Microsoft tech writers aren't sure about it. So I wouldn't be surprised if there's some variation on Win 7 vs Win 8 vs Win 10, and full-screen might be one of the differences.
Anyway, one thing we could try is to explicitly minimize the VP window when you try to switch away from it. Here's some Javascript code that you can try out: this will intercept the Pause Game command, minimize the current foreground window, and then let PinballY do its normal task switch attempt. It also intercepts Resume so that it can restore the old window. Drop this into a text file called Main.js in your PinballY Scripts folder.
(function() {
let User32 = dllImport.bind("User32.dll", `
HWND GetForegroundWindow();
BOOL SetForegroundWindow(HWND);
LONG_PTR SendMessageTimeoutW(HWND, UINT, WPARAM, LPARAM, UINT, UINT, DWORD_PTR*);
`);
const WM_SYSCOMMAND = 0x0112;
const SC_MINIMIZE = 0xF020;
const SC_RESTORE = 0xF120;
let pausedWindow;
let result = dllImport.create("DWORD_PTR");
mainWindow.on("command", ev => {
if (ev.id == command.PauseGame) {
pausedWindow = User32.GetForegroundWindow();
mainWindow.doCommand(command.PauseGame);
if (pausedWindow)
User32.SendMessageTimeoutW(pausedWindow, WM_SYSCOMMAND, SC_MINIMIZE, 0, 20, result);
User32.SetForegroundWindow(mainWindow.hwndFrame);
ev.preventDefault();
}
else if (ev.id == command.ResumeGame) {
if (pausedWindow)
User32.SendMessageTimeoutW(pausedWindow, WM_SYSCOMMAND, SC_RESTORE, 0, 20, result);
}
});
})();
I should add that if this works, I can add do something like that in the main program, so that you won't need the javascript. But we can try the javascript version to see if it actually helps, to see if it's worth making the change in the program itself.