Click here to Skip to main content
15,867,835 members
Articles / Programming Languages / C++
Article

Simulate Alt+Control+delete

Rate me:
Please Sign up or sign in to vote.
2.43/5 (14 votes)
20 Jan 2003 190.5K   3.8K   28   51
How to Simulate Alt+Control+delete

Introduction

Simulate alt control delete command in windows nt, 2k, xp.
hwinsta = OpenWindowStation("winsta0", FALSE,
                          WINSTA_ACCESSCLIPBOARD   |
                          WINSTA_ACCESSGLOBALATOMS |
                          WINSTA_CREATEDESKTOP     |
                          WINSTA_ENUMDESKTOPS      |
                          WINSTA_ENUMERATE         |
                          WINSTA_EXITWINDOWS       |
                          WINSTA_READATTRIBUTES    |
                          WINSTA_READSCREEN        |
                          WINSTA_WRITEATTRIBUTES);
if (hwinsta == NULL)
    return FALSE;
//
// Set the windowstation to be winsta0
//
if (!SetProcessWindowStation(hwinsta))
 return FALSE;

//
// Get the default desktop on winsta0
//
hdesk = OpenDesktop("Winlogon", 0, FALSE,
                    DESKTOP_CREATEMENU |
          DESKTOP_CREATEWINDOW |
                    DESKTOP_ENUMERATE    |
                    DESKTOP_HOOKCONTROL  |
                    DESKTOP_JOURNALPLAYBACK |
                    DESKTOP_JOURNALRECORD |
                    DESKTOP_READOBJECTS |
                    DESKTOP_SWITCHDESKTOP |
                    DESKTOP_WRITEOBJECTS);
if (hdesk == NULL)
   return FALSE;

//
// Set the desktop to be "default"
//
if (!SetThreadDesktop(hdesk))
   return FALSE;
PostMessage(HWND_BROADCAST,WM_HOTKEY,0,
    MAKELPARAM(MOD_ALT|MOD_CONTROL,VK_DELETE));

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions

 
QuestionOpenDesktop call Pin
Member 1480415816-Apr-20 8:35
Member 1480415816-Apr-20 8:35 
QuestionDoes not work on Windows 7 Pin
babzog13-Aug-14 4:17
babzog13-Aug-14 4:17 
GeneralIt does not work on Vista Pin
Ronakkumar Patel18-Dec-07 13:27
Ronakkumar Patel18-Dec-07 13:27 
GeneralRe: It does not work on Vista Pin
ppckiller10-Jan-08 3:50
ppckiller10-Jan-08 3:50 
AnswerRe: It does not work on Vista Pin
Decipator29-Jun-09 3:15
Decipator29-Jun-09 3:15 
GeneralRe: It does not work on Vista Pin
Jose A Pascoa15-Sep-10 2:43
Jose A Pascoa15-Sep-10 2:43 
QuestionIt is not working on WinXP SP2 Pin
koldovsky21-Feb-07 8:24
koldovsky21-Feb-07 8:24 
AnswerRe: It is not working on WinXP SP2 Pin
md.ikra29-Jul-07 0:54
md.ikra29-Jul-07 0:54 
QuestionExcellent for Admin with 300 computers to ctrl alt del at the same time ! Pin
md.ikra28-Jan-07 19:51
md.ikra28-Jan-07 19:51 
AnswerRe: Excellent for Admin with 300 computers to ctrl alt del at the same time ! Pin
MDKing8311-Jul-08 4:56
MDKing8311-Jul-08 4:56 
QuestionSend Mouse Clicks & Other KeyStrokes Pin
Deepak Sakpal25-Aug-06 7:30
Deepak Sakpal25-Aug-06 7:30 
AnswerRe: Send Mouse Clicks & Other KeyStrokes Pin
MDKing8311-Jul-08 4:57
MDKing8311-Jul-08 4:57 
Generalit can not work ! Pin
charlie790822-Aug-06 2:01
charlie790822-Aug-06 2:01 
Generalit wasn't work Pin
brs_jom19-Jan-06 7:51
brs_jom19-Jan-06 7:51 
GeneralRe: it wasn't work Pin
antifumo2-Feb-06 8:34
antifumo2-Feb-06 8:34 
GeneralRe: it wasn't work Pin
midea097819-Aug-06 5:02
midea097819-Aug-06 5:02 
GeneralI got Access Denied when call OpenDesktop Pin
Yulaw21-Aug-05 20:32
Yulaw21-Aug-05 20:32 
GeneralJust DOESN'T work Pin
sk196515-Feb-05 0:53
sk196515-Feb-05 0:53 
GeneralNext step to unlock screen Pin
anthonyx2618-Nov-04 4:22
anthonyx2618-Nov-04 4:22 
GeneralSimulate Alt+Control+delete in Activex Pin
sankul99911-Oct-04 21:05
sankul99911-Oct-04 21:05 
Questionaltctrldel.exe can't use in winxp??? Pin
netsh25-Jul-04 14:59
netsh25-Jul-04 14:59 
QuestionCan't run in win200, why? Pin
yinju14-Apr-04 7:29
yinju14-Apr-04 7:29 
AnswerRe: Can't run in win200, why? Pin
DavidR_r2-Jul-04 9:23
DavidR_r2-Jul-04 9:23 
GeneralSetThreadDesktop Pin
paulashford25-Feb-04 23:56
paulashford25-Feb-04 23:56 
GeneralRe: SetThreadDesktop Pin
planets23-Mar-04 6:17
planets23-Mar-04 6:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.