Python ctypes keybd_event模拟ctrl + alt + delete [英] Python ctypes keybd_event simulate ctrl+alt+delete

查看:261
本文介绍了Python ctypes keybd_event模拟ctrl + alt + delete的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用keybd_event模拟ctrl + alt + del,但是它什么也没做,像ctrl + esc或alt + tab这样的东西都可以,但是ctrl + alt + del却不起作用.

I'm trying to simulate ctrl+alt+del with keybd_event but it doesn't do anything, stuff like ctrl+esc or alt+tab do work yet ctrl+alt+del won't work.

import ctypes
ctypes.windll.user32.keybd_event(0x11, 0, 0, 0) #CTRL is down
ctypes.windll.user32.keybd_event(0x12, 0, 0, 0) #ALT is down
ctypes.windll.user32.keybd_event(0x2E, 0, 0, 0) #DEL is down
ctypes.windll.user32.keybd_event(0x2E, 0, 0x0002, 0) #DEL is up
ctypes.windll.user32.keybd_event(0x12, 0, 0x0002, 0) #ALT is up
ctypes.windll.user32.keybd_event(0x11, 0, 0x0002, 0) #CTRL is up

推荐答案

CTRL + ALT + DEL 是一个特殊的键序列,已知作为安全注意序列,出于安全原因,不能使用keybd_input.

CTRL + ALT + DEL is a special key sequence, known as the secure attention sequence that, for security reasons, cannot be faked using keybd_input or SendInput.

您将需要使用 SendSAS API调用以模拟SAS.请仔细阅读文档,并确保遵守此功能的严格要求.

You will need to use the SendSAS API call to simulate the SAS. Do read the documentation carefully do make sure that you adhere to the stringent requirements of this function.

这篇关于Python ctypes keybd_event模拟ctrl + alt + delete的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆