且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何创建一个类似 kiosk 的 UI,让用户永远无法退出或切换到另一个应用程序?

更新时间:2023-11-22 16:39:16

我认为你***创建一个新的 桌面,然后在那里运行您的应用程序.当您的应用程序完成后,您可以带回用户的桌面.这就是 Windows 登录屏幕的工作原理.当然,Windows 登录屏幕使用特殊的安全桌面.您在单独桌面中的应用程序将被隔离.您将拥有一个没有开始菜单、任务栏或桌面图标的桌面背景,因为 explorer.exe 不会在那里自动运行.当然a可以启动一个新进程,使用任务管理器,但是Windows中的桌面是安全对象;因此,您可以根据需要进行限制.当然,前提是您的应用具有足够的权限.

I think you'd better create a new desktop, and run your app in there. When your app is done, you can bring back user's desktop. That is how Windows login screen works. Of course Windows login screen uses a special secure desktop. Your app in a separate desktop would be isolated. You will have a desktop background with no start menu, taskbar, or desktop icons because explorer.exe is not running there automatically. Of course a can start a new process, using Task Manager, but desktops in Windows are securable objects; therefore, you can make restrictions if you want. Of course if your app has sufficient permissions.

要创建新桌面,您可以使用 CreateDesktop Windows API,切换到新创建的桌面,可以使用OpenDesktop功能.

To create a new desktop, you can use CreateDesktop Windows API, and to switch to the newly created desktop, you can use OpenDesktop function.