当用户解锁 Windows 计算机时如何运行 .net 代码?
当用户解锁其计算机时,如何运行 .net 代码?
Windows 版本:XP 和 7
How do I run .net code when a user unlocks their machine?
Windows versions: XP and 7
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
如果您想订阅会话锁定/解锁事件(例如,当您锁定 PC 时 Messenger 如何将您的状态设置为离开),那么本文看起来非常适合您。
http://blogs.msdn.com/b/shawnfa/archive/2005/05/17/418891.aspx
或者,您可以按照以下 ServerFault 问题在 Windows 7 解锁上运行脚本: https://serverfault.com/questions/148258/run- a-script-after-i-unlock-my-windows-session
This article looks perfect for you if you want to subscribe to the session lock/unlock events (e.g. how Messenger sets your status to away when you lock your PC).
http://blogs.msdn.com/b/shawnfa/archive/2005/05/17/418891.aspx
Alternatively, you can run a script on Windows 7 unlock as per this ServerFault question: https://serverfault.com/questions/148258/run-a-script-after-i-unlock-my-windows-session
马特米切尔是对的,他建议的文章可能会对您有所帮助。
如果没有,一般来说,您正在寻找有关 ISensLogon 界面,它允许您监视您正在查找的事件。如果您在 google 上搜索 ISensLogon,您会发现很多有关使用它的不同方法的文章,至少其中一篇可能会对您有所帮助。
MattMitchell is right that the article he suggests might help you.
On the chance that it doesn't, in a general sense you're looking for information on the ISensLogon interface, which is what allows you to monitor the events you're looking for. If you search for ISensLogon on google, you'll find a lot of articles about a lot of different ways to use it, at least one of which will probably help you.
可惜你还得支持XP。 Windows 7 中有一个很好的计划任务功能,包括在工作站解锁时触发它。只需几行代码...您也可以添加诸如“如果机器使用电池,则不要执行此操作”之类的内容。
It's too bad you have to support XP as well. There's a nice scheduled task capability in Windows 7 that includes triggering it on workstation unlock. Would be just a few lines of code... and you could include things like "don't do it if the machine is on battery" too.