简体   繁体   English

CTRL + ALT + DEL在win32api和python中不起作用

[英]CTRL+ALT+DEL not working in win32api and python

I am using python to virtually run the keyboard, using the following code for doing Ctrl + Alt + Del is not working, however, Ctrl + Shift + Tab or other key combinations are working this way. 我正在使用python虚拟运行键盘,使用以下代码执行Ctrl + Alt + Del不起作用,但是Ctrl + Shift + Tab或其他组合键正在这种方式工作。 The list of hex codes I am referring is from here 我要引用的十六进制代码列表从这里

import win32api
import win32con
import time

win32api.keybd_event(0xA2, 0,0,0)
time.sleep(.01)
win32api.keybd_event(0xA4, 0,0,0)
time.sleep(.01)
win32api.keybd_event(0x2E, 0,0,0)
time.sleep(.04)

win32api.keybd_event(0xA2,0 ,win32con.KEYEVENTF_KEYUP ,0)
time.sleep(.01)
win32api.keybd_event(0xA4,0 ,win32con.KEYEVENTF_KEYUP ,0)
time.sleep(.01)
win32api.keybd_event(0x2E,0 ,win32con.KEYEVENTF_KEYUP ,0)

Help from anyone would be appreciated. 任何人的帮助将不胜感激。 Using windows 7 for this purpose. 为此使用Windows 7。

The secure attention sequence (SAS) cannot be produced by faking input. 伪造输入不能产生安全注意序列(SAS) You need to call the SendSAS function. 您需要调用SendSAS函数。

Note that the documentation for SendSAS lists some rather severe conditions for its use. 请注意, SendSAS的文档列出了一些相当严格的使用条件。 You will need to adhere carefully to these conditions in order to succeed, and this might well prove very difficult for a Python program. 为了成功,您将需要认真遵守这些条件,这对于Python程序来说可能非常困难。 It make be expedient to wrap the call to SendSAS in a separate executable. SendSAS的调用SendSAS在单独的可执行文件中会很方便。

Ctrl + Alt + Del is a reserved system function in Windows for all I know. 我所知, Ctrl + Alt + Del是Windows中保留的系统功能。 This means that the operating system will not pass the command on to your program at all. 这意味着操作系统完全不会将命令传递给您的程序。

Someone correct me on this if I'm wrong though. 如果我错了,还是有人纠正我。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM