gpt4 book ai didi

c# - 如何使用 C# 锁定屏幕?

转载 作者:太空狗 更新时间:2023-10-29 21:03:33 24 4
gpt4 key购买 nike

我刚刚编写了我的第一个 C# 应用程序,它是一个调度程序。每小时一次,我想弹出一个对话框并锁定屏幕两分钟,以便休息一下。

到现在为止,我的应用程序只是在中断时间时在“TopMost”上显示一个表单,并在两分钟后隐藏它。

如何锁定屏幕?类似于 Vista 中的 UAC 样式。

最佳答案

Eep,误读了你的问题。 Vista 的 UAC 对话框会创建一个新桌面并在上面显示自己。要创建桌面,您可以使用 CreateDesktop功能。然后您可以使用 SwitchDesktop切换到它。

如果您真的想重新创建安全桌面的外观,那么您需要先截取屏幕截图并将其显示在您的表单上,稍微变暗。


下面的原始答案,可能也很有趣:

Take a look at the LockWorkStation function.

However, you can't programmatically unlock the work station again. That's something the user has to do himself. So you can't easily enfore a break at least two minutes long unless you still resort to your top-level window technique to deny the user his workspace as long as the two minutes are not yet over.

关于c# - 如何使用 C# 锁定屏幕?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1588283/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com