Link to home
Start Free TrialLog in
Avatar of allio
allio

asked on

Artificial Ctrl Alt Del

Hello

Can you make a button that simulates CTRL ALT DEL?
It's like clicking this button is just the same as pressing  CTRL ALT DEL at the same time?


thanks

Avatar of robert_marquardt
robert_marquardt

Generating CTRL ALT DEL is impossible. keybd_event filters this combination.
No idea how to do that .
But maybe this help you:

...simulate Ctrl-C

 keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), 0, 0);
 keybd_event(Ord('C'), MapVirtualKey(Ord('C'), 0), 0, 0);
 keybd_event(Ord('C'), MapVirtualKey(Ord('C'), 0), KEYEVENTF_KEYUP, 0);
 keybd_event(VK_CONTROL, MapVirtualKey(VK_CONTROL, 0), KEYEVENTF_KEYUP, 0)
Avatar of allio

ASKER

So you can't simulate Ctrl Alt Del?

Any other suggestions how to have the same effect as when you press Ctrl Alt Delete in windows?  

After all it should be possible to trigger the dialog showing up. If it is available via API function then you can call it.
Avatar of allio

ASKER

Can you Disable the keyboard ? thru delphi
and enable it back ?

or better disable the keyboard with the mouse? or disable the mouse?
Avatar of allio

ASKER

Can you Disable the keyboard ? thru delphi
and enable it back ?

or better disable the keyboard with the mouse? or disable the mouse?
Just found some assembler routines to do a warm & cold reboot -

http://www.geocities.com/SiliconValley/2926/tpsrc/rebootcon.html
you can only do this via a service application on nt/2k or maybe a custom gina stub on win9*(highly unrecommeded).

why do you need this? ,there maybe another way to do what your after.
ps,
reboots?
ExitWindowsEx() would be proper way ..
y those routines use absolute addressing - not a great idea these days...
To disable/enable the keyboard use:

const KH: Integer = 0;

function KBDProc(Code: Integer; W: WParam; L: LParam): Integer; stdcall;
begin
 Result := -1;
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  if KH = 0 then
    KH := SetWindowsHookEx(WH_KEYBOARD, @KBDProc, 0, MainThreadID) else
  begin
    UnhookWindowsHookEx(KH);
    KH := 0;
  end;
end;
At http://www.delphi3000.com/article.asp?ID=2262 can be found next article : 'Disable Keyboard and Mouse'
whay don't try to create your own dialogs alike the Task Manager ?

I have a project that return all running processes into a ListBox. And ShutDown,StandBy and Restart are very esy to simulate .
whay don't try to create your own dialogs alike the Task Manager ?

I have a project that return all running processes into a ListBox. And ShutDown,StandBy and Restart are very esy to simulate .

In same time can terminate a running process from list
Disabling Keyboard/mouse except Crt+Alt+Del:

procedure BlockInput; external 'user32.dll';

procedure Block;
asm
 push 1
 call BlockInput
end;

procedure UnBlock;
asm
 push 0
 call BlockInput
end;

Disabling Crt+Alt+Del:
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 1, 0, 0);
Enabling Crt+Alt+Del:
SystemParametersInfo(SPI_SCREENSAVERRUNNING, 0, 0, 0);
If you want to see programm manager, you can run it directly:

WinExec('taskmgr', SW_SHOW);
Create a VxD and force the reboot from ring 0 code.
Avatar of Manuel Lopez-Michelone
I had this old code for turbo pascal, but i dont know how to make it works in delphi... Anyway, hope this help.

best regards,
Manuel Lopez (lopem)

Program Reboot;

{ Programa : Reboot    }
{ Programo : La_Morsa  }
{ Version  : 1.00      }
{ Fecha    : 10/jul/91 }

{ Este programa hace un warmboot (reboot), duplicando  }
{ practicamente el codigo invocado al hacer un ctrl-alt-del }

var
   reset_flag : integer Absolute $0040:$0072;

procedure Limpia_Buffer;

{ Este procedimiento limpia el buffer del teclado, haciendo  }
{ que el ultimo caracter del mismo apunte al primer caracter }
{ de dicho buffer.                                           }

var
    BufferHead  : integer absolute $0000:$041A; {current head}
    BufferTail  : integer absolute $0000:$041C; {current tail}

begin
  BufferTail:=BufferHead;
end; {Limpia_Buffer}


begin
  writeln;
  writeln('Reboot 1.0');
  writeln('Copyright La_Morsa Software Co.');
  writeln;
  write('Oprima [Enter] para rebootear...');
  Limpia_Buffer; readln;
  reset_flag:=$1234;
  inline($EA/$5B/$E0/$00/$F0); {JMP F000:E05B}
end.
Here is a shutdown function specifically for NT 2000 XP

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/sysinfo/shutdown_04ry.asp

InitiateSystemShutdown
The InitiateSystemShutdown function initiates a shutdown and optional restart of the specified computer.











can we let allio please say what it is he actually wants?

so far we have rebooting via several ways (where that mentioned in the question?)
enabling/disabing mice and keyboards various ways
winex-ing taskmanagers ?

>>>where that mentioned in the question

And your point being. Sometimes we are left with just having to quess what the questioner really wants so the comments are in anticipation of that. Don't see how that shuould be a problem. :>)
BTW inthe I meant to post a follow up of my last comment but I forgot to do so to say that my last comment was meant to be of a humorous nature. :>)
Avatar of allio

ASKER

Ginsonic, I tried your Disable keyboard it works , but only on that form of delphi, I want to disable keyboard for the whole windows.

Crazyone,
 what I want to do is , to halt the system of the user, and I thought the best way is to ctrl alt del and lock the workstation, but since it's not very easy to do, my alternative is to disable the keyboard so the user can't use the PC unless I let him to. Thanks for the answers guys
Hope this makes it clear
SOLUTION
Avatar of CrazyOne
CrazyOne
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Good article '...block keyboard and mouse input ?'  http://www.swissdelphicenter.ch/torry/showcode.php?id=312
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
This question is reasonably current, others elow are not.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  https://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
https://www.experts-exchange.com/questions/Q.11410418.html
https://www.experts-exchange.com/questions/Q.20247100.html
https://www.experts-exchange.com/questions/Q.20290838.html
https://www.experts-exchange.com/questions/Q.20291273.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
https://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
https://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
allio->  If you would like me to award one or more expert for contributions here, let me know please... I can split points for you.  
MOondancer - EE Moderator
Avatar of allio

ASKER

moondancer
i want to split the points to
100 to crazyone
100 to ginsonic
100 to Iopem

thanks
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Split points between crazyone, ginsonic and Iopem

Please leave any comments here within the next seven days.
 
PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER!
 
Paul (pnh73)
EE Cleanup Volunteer