Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7590319
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T20:22:16+00:00 2026-05-30T20:22:16+00:00

all is said in the title, how can I simulate the combination Ctrl +

  • 0

all is said in the title, how can I simulate the combination Ctrl+Alt+DEL?

I tried this:

SendKeys.Send("^(%({DEL}))")
SendKeys.Send("^(%{DEL})") 
SendKeys.Send("^%{DEL}")

But none worked. I am working on VB.NET and Windows XP SP3

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T20:22:18+00:00Added an answer on May 30, 2026 at 8:22 pm

    I finally found this C++ code on CodeProject, which works well when launched as System user. Therefore, I converted the code into a dll, and called the function from my code.

    Here is the c++ code (you can use the ErrorExit example function that uses GetLastError from MSDN in case a problem occured):

    #include "windows.h"
    #include <strsafe.h>
    
    __declspec(dllexport) BOOL SimulateAltControlDel()
    {
        HDESK   hdeskCurrent;
        HDESK   hdesk;
        HWINSTA hwinstaCurrent;
        HWINSTA hwinsta;
    
        // 
        // Save the current Window station
        // 
        hwinstaCurrent = GetProcessWindowStation();
        if (hwinstaCurrent == NULL)
            return FALSE;
        // 
        // Save the current desktop
        // 
        hdeskCurrent = GetThreadDesktop(GetCurrentThreadId());
        if (hdeskCurrent == NULL)
            return FALSE;
        // 
        // Obtain a handle to WinSta0 - service must be running
        // in the LocalSystem account
        // 
        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));
    
    
        // 
        // Reset the Window station and desktop
        // 
        if (!SetProcessWindowStation(hwinstaCurrent))
           return FALSE;
    
        if (!SetThreadDesktop(hdeskCurrent))
        return FALSE;
    
        // 
        // Close the windowstation and desktop handles
        // 
        if (!CloseWindowStation(hwinsta))
            return FALSE;
        if (!CloseDesktop(hdesk))
            return FALSE;
        return TRUE;
    }
    

    You also need to add a .def file to the project to export the function correctly (the project is named AltCtrlDelCpp) and tell the linker that the definition file of the module is this file

    ;altctrldel.def
    LIBRARY AltCtrlDelCpp
    
    ;CODE PRELOAD MOVEABLE DISCARDABLE
    ;DATA PRELOAD MOVEABLE
    
    EXPORTS
       SimulateAltControlDel
    

    Then, in the .NET solution, you add the dll to the project, configures it so that it is always copied in the output directory, and you just use DllImport to import the function:

    C# Code

    [DllImport(@"AltCtrlDelCpp.dll")]
    static extern bool SimulateAltControlDel();
    

    VB.NET Code

    <DllImport("AltCtrlDelCpp.dll")> _
    Private Function SimulateAltControlDel() As Boolean
    

    In VB.NET, you also need to add the attribute to the Sub Main :

    <MTAThread()> _
    Sub Main()
    

    Then you just have to call the SimulateAltControlDel function and there you go. Please note that I had this work only for a Console Apps, it didn’t work in winform apps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Title said it all. im just wandering if there something i can use in
Title said it all. Some context: I got a search mechanism - search view,
all is said in the title, I want to get from an element all
As The Title said, I tried to implement a custom taxonomy in wordpress, i
All I know about the constraint is it's name ( SYS_C003415 ), but I
All I want is to update an ListViewItem's text whithout seeing any flickering. This
As the title said, I got a problem! i encountered the RJS Error:[object error],the
As title said, I'm trying to figure out how to use javascript and jquery
Hope the title is not that confusing - honestly said I had no idea
maybe some one can help me with this... I have a custom search button

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.