I've done some research but I would like to be able to call control-alt-delete from python. If that is not possible is it possible to call it from command line because then I could just use that command in python because I can call command lines in python. If someone could point me in the right direction that would be great. this is for a task manager written with wxPython. edit: im trying to launch the windows security and from a user answer i tried
import win32com.client
shell = win32com.client.Dispatch("WScript.Shell")
shell.SendKeys("{CONTROL}{ALT}{DELETE}")
and i get this error
Traceback (most recent call last):
File "C:/Python27/tescontrol.py", line 4, in <module>
shell.SendKeys("{CONTROL}{ALT}{DELETE}")
File "<COMObject WScript.Shell>", line 2, in SendKeys
com_error: (-2147352567, 'Exception occurred.', (0, None, None, None, 0, -2147024809), None)
If what you want to do is to shutdown or restart the system, Windows has a 'shutdown' command and linux's typically have 'shutdown' and 'reboot' commands.
Check out the following thread:
According to it, VNC uses something like this:
I suspect you would need to use ctypes or PyWin32 to do something like this. I would probably go with ctypes since it's cross-platform, however, even with ctypes you would probably need to write a special method for each OS that you support.
You surely mean activating the Windows Security window. In this case:
UPDATE
The above code seems not to work because of the reasons described in other posts. In that case, the alternative is to create a similar window and call from Python the different programs/functions called by the real Windows Security window.
On reading OP's comments to the original question, OP's final need is to change a user's password. This can be done with:
I just tested this in my PC, so is final information (though not necessarily correct; this is up to the OP :-) ).
UPDATE 2: Copying the later as a separate answer as comments seem to indicate that all of the answer doesn't work. This is correct for the
SendKeys
proposition, which doesn't work.You can use vncdotool library At:
And use vncdotool by:
As far as I know, Ctrl-Alt-Delete is protected for security reasons, so programs cannot use it. (At least in Windows 7 and before.)
On reading OP's comments, his/her original need was to change the user's password. In fact, this can be done with: