在锁定或解锁 Windows XP 时运行脚本

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/270629/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 11:34:42  来源:igfitidea点击:

Run a script when either locking or unlocking Windows XP

windowshooklockingscripting

提问by ljc

I have a Windows XP machine and a Linux machine running Ubuntu. I share the keyboard/mouse from the Windows machine via Synergy. What I would like to do is lock/unlock the Linux machine whenever I lock/unlock the Windows machine.

我有一台 Windows XP 机器和一台运行 Ubuntu 的 Linux 机器。我通过Synergy从 Windows 机器共享键盘/鼠标。我想做的是在我锁定/解锁 Windows 机器时锁定/解锁 Linux 机器。

So I'd like to be able to run a script of some description when Windows either locks or unlocks the screen.

所以我希望能够在 Windows 锁定或解锁屏幕时运行一些描述的脚本。

采纳答案by R?mulo Ceccon

The standard way in Windows is to write a package(a dll) that subscribes to Winlogon notification events.

Windows 中的标准方法是编写一个订阅Winlogon 通知事件的包(一个dll)。

I don't know of any tool that provides an easy way to hook into those events, but you could make your package launch a script from some specific place if you really need your actions to be inside one.

我不知道有什么工具可以提供一种简单的方法来挂钩这些事件,但是如果您确实需要将操作放在某个特定位置,则可以让您的包从某个特定位置启动脚本。