simulate ctrl+alt+delete keys in windows

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Abdul Khaliq
    New Member
    • Feb 2008
    • 2

    simulate ctrl+alt+delete keys in windows

    Hi all

    i want to simulate the ctrl + alt + delete keys

    I am facing problem with this code. I able to get the reference of the "winlogon" desktop but am unable to simulate the ctrl + alt + delete keys.

    can any one help please.


    HDESK desktop;
    ofstream myfile;

    HDESK old_desktop = GetThreadDeskto p(GetCurrentThr eadId());
    myfile.open ("c:\\desktop.t xt");
    // Attempt to open the named desktop
    esktop = OpenDesktop("Wi nlogon", 0, FALSE,
    DESKTOP_CREATEM ENU | DESKTOP_CREATEW INDOW |
    DESKTOP_ENUMERA TE | DESKTOP_HOOKCON TROL |
    DESKTOP_WRITEOB JECTS | DESKTOP_READOBJ ECTS |
    DESKTOP_SWITCHD ESKTOP | GENERIC_WRITE);

    if(desktop!=NUL L){
    myfile << "desktop found.\n";
    }else{
    myfile << "desktop not found.\n";
    }
    HWND hwndCtrlAltDel = FindWindow("SAS window class", "SAS window");
    if (hwndCtrlAltDel == NULL) {
    myfile << "SAS window not found.\n";
    hwndCtrlAltDel = HWND_BROADCAST;
    }
    PostMessage(hwn dCtrlAltDel, WM_HOTKEY, 0, MAKELONG(MOD_AL T | MOD_CONTROL, VK_DELETE));

    HWND logonwindow = FindWindow("", "Log On to Windows");
    if (logonwindow == NULL) {
    myfile << "logon window not found.\n";
    }
    myfile.close();
  • loluser555
    New Member
    • Feb 2008
    • 2

    #2
    Why not just start taskmgr.exe? I think simulating keystroke events might also work.

    Comment

    • Abdul Khaliq
      New Member
      • Feb 2008
      • 2

      #3
      no i wanted to simulate the keys remotely

      for this i had embedded the above code in the a service.

      I send an event to the service to simulate the ctrl+alt+delete keys.

      I am not able to find the SAS window I am getting NULL for the first time. Also broadcasting message to all the windows dosen't seems to work at all. I have a problem with this section of code below.

      HWND hwndCtrlAltDel = FindWindow("SAS window class", "SAS window");
      if (hwndCtrlAltDel == NULL) {
      myfile << "SAS window not found.\n";
      hwndCtrlAltDel = HWND_BROADCAST;
      }
      PostMessage(hwn dCtrlAltDel, WM_HOTKEY, 0, MAKELONG(MOD_AL T | MOD_CONTROL, VK_DELETE));

      Comment

      • sicarie
        Recognized Expert Specialist
        • Nov 2006
        • 4677

        #4
        Sounds like you're trying to remotely log on to a Windows machine, is this right?

        Comment

        Working...