适用于旧版 16 位应用程序的 Kiosk 模式
我需要以编程方式最小化和最大化全屏 16 位应用程序。不幸的是,DosBox 不是一个选项,因为该应用程序与 DosBox 不支持的某些外围设备进行通信。
我能够编写代码(主要是 Win32 API)来设置焦点、发送 alt + Enter 键以及最小化/最大化。
一切都会正常,但是,一些用户发现 Alt + Enter 可以退出全屏,并开始滥用这一点。
我可以使用 PIF 中的设置禁用 Alt + Enter,但这会破坏我以编程方式发送这些键的方法。
有没有比发送 Alt + Enter 更好的替代方案来让 NTVDM 以编程方式切换全屏?
我使用 Spy++ 发现要实现全屏 NTVDM,需要将系统分辨率更改为 640 x 480。
我尝试调用 ChangeDisplaySettings API 根据需要切换分辨率,但当我设置 640 x 480 时,NTVDM 仍然作为窗口应用程序运行。
我正在考虑设置一个低级键盘挂钩(http://msdn.microsoft.com/en-us/library/ms644985(v=vs.85).aspx)来过滤 Alt + Enter。我可以在我的应用程序发送它的短暂时间内禁用该钩子。这听起来像是一个危险的黑客行为,可能会产生很多副作用。我也不确定它是否有效,因为 NTVDM 似乎不使用消息循环来处理键盘输入。 SendMessage API 不会产生结果,并且 Alt + Enter 必须使用 keybd_event API 发送。有什么想法吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
换一种方法怎么样——不要试图阻止它。相反,请跟踪窗口(例如 10 倍秒),如果它不是全屏并且您在最后几秒内没有发送 Alt-Enter,请发送一个。
如果有人按下 Alt-Enter,它会进入一个窗口并立即返回全屏。
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.