I need to programmatically minimize and maximize a fullscreen 16bit application. Unfortunately DosBox is not an option as this app talks to some peripherals not supported by DosBox.
I was able to write code (heavy on the Win32 API) that can set the focus, send the alt + enter keys and minimize/maximize.
Everything would work, however, some users have figured out that Alt + Enter can exit fullscreen and have started to abuse this.
I can disable Alt + Enter using the settings in a PIF, but that breaks my approach of programmatically sending those keys.
Is there a better alternative for getting NTVDM to programmatically toggle fullscreen than sending Alt + Enter?
I used Spy++ and found that to achieve fullscreen NTVDM was changing the system resolution to 640 x 480.
I attempted to call the ChangeDisplaySettings API to toggle the resolutions as needed, but when I set 640 x 480 NTVDM still runs as a windowed app.
I'm considering setting up a low level keyboard hook (http://msdn.microsoft.com/en-us/library/ms644985(v=vs.85).aspx) to filter Alt + Enter. I could disable the hook for the brief moment it takes my app to send it. This sounds like a dangerous hack that could have a lot of side-effects. I'm also not sure it would work since NTVDM doesn't seem to use a message loop for processing keyboard input. The SendMessage API doesn't produce results, and Alt + Enter had to be sent using the keybd_event API. Any thoughts?
How about a different approach--quit trying to block it. Instead, keep track of the window (say 10x second), if it's not full screen and you didn't send an Alt-Enter in the last couple of seconds, send one.
If someone hits Alt-Enter it goes into a window and immediately back to full screen.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With