views:

1489

answers:

2

Can I simulate in C#/C++ code Control-Alt-Delete sequence in Vista? When UAC enabled/disabled? How it is done in XP?

Can you provide a code sample that works in Vista?

+1  A: 

PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE));

You get PostMessage from the user32 dll

edit: CodeProject article that has code for it

edit: There is some discussion from VNC on why that won't work in Vista and how to set up UAC to allow it.

Lou Franco
before I mod you up :), the article does not mention vista. does it work with vista?
Sunny
No -- Look at the article on VNC for the caveats for sending CTRL-ALT-DEL to Vista with UAC enabled. You cannot do that, it seems. There are ways to bring up the Task Manager if that's what you are aiming to do.
Lou Franco
+6  A: 

Existing code to simulate the Secure Attention Sequence (SAS), which most people refer to as control alt delete or ctrl-alt-del, no longer works in Windows Vista. It seems that Microsoft offers a library that exports a function called SimulateSAS(). It is not public and one is supposed to request it by sending a mail to [email protected].

There is a similar library available with the following features:

  • Works both with and without User Account Control (UAC)
  • Supports current, console and any Terminal Server session
  • Does not need a driver
  • The calling application does not need to be signed or have a special manifest
  • Supports multiple programming languages

Please note that this library is not free. Meanwhile you can contact [email protected] if you are interested in it.

M. Jahedbozorgan
Enjoy your Necromancer badge!
Roger Pate
Thank for linking to my SasLibEx which indeed supports simulating SAS and lot's more!
Remko