WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Ctrl Alt Del Issues

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

Disable Task Manager


Question:

In XP/NT/2000 you can hit CTL-ALT-DEL and use the Task Manager to kill a program. Is it possible to counter this in a winbatch script (I doubt it, but just curious.)

Answer:

  1. Default Answer:

    http://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Hiding-Disabling~Apps~to~Prevent~User~Intervention+Disable~an~Apps~Close~Menu~Item.txt

  2. Trick 1: http://www.codeproject.com/KB/miscctrl/disablectraltdelwindowsxp.aspx

  3. Trick 2 :
    ;  A couple of ways to check for Task Manager.
    ;
    ; 1 - This sorta works for closing Task Manager
    ;     once Ctrl + Alt + Del is pressed.  It works
    ;     better if the timedelay is removed.  But
    ;     then CPU goes up to 99%.
    ;
    
    ; 2 - Just wait for Task Manager to exist and
    ;     close it.
    ;
    ; Of course, there is a policy you could use to
    ; do the same thing.
    
    Goto two
    
    :one
    
    #DefineFunction GetKeyboardState(buf)
       sDLLName = StrCat(DirWindows(1), "user32.dll")
       DllCall(sDLLName, long:"GetKeyboardState", lpbinary:buf)
       BinaryEodSet(buf, 256)
       Return buf
    #EndFunction
    
    ;==============================
    ;start
    ;==============================
    
    ;boxopen("","Press any key.")
    
    buf1 = BinaryAlloc(256)
    
    While @TRUE
      kb = GetKeyboardState(buf1)
      control = BinaryPeek(buf1,17)
      alt = BinaryPeek(buf1,18)
      del = BinaryPeek(buf1,46)
      a = BinaryPeek(buf1,65)
      If control & 128 && alt & 128 && del & 128
     ;  message("test","Ctrl + Alt + Delete pressed")
        If WinWaitExist("Windows Task Manager",1) Then SendKeysTo("Windows Task Manager","{ESC}")
       ; break
      EndIf
      TimeDelay(.001)
      If IsKeyDown(@CTRL & @SHIFT) Then Break
    EndWhile
    
    BinaryFree(buf1)
    
    Exit
    
    :two
        If WinWaitExist("Windows Task Manager",-1) Then SendKeysTo("Windows Task Manager","{ESC}")
        If IsKeyDown(@CTRL & @SHIFT) Then Exit
    Goto two
    

Article ID:   W16489
File Created: 2014:07:18:09:51:38
Last Updated: 2014:07:18:09:51:38