Solved

Artificial Ctrl Alt Del

Posted on 2002-04-19
31
548 Views
Last Modified: 2010-04-04
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

0
Comment
Question by:allio
  • 7
  • 5
  • 4
  • +8
31 Comments
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
Generating CTRL ALT DEL is impossible. keybd_event filters this combination.
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
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)
0
 

Author Comment

by:allio
Comment Utility
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?  

0
 
LVL 11

Expert Comment

by:robert_marquardt
Comment Utility
After all it should be possible to trigger the dialog showing up. If it is available via API function then you can call it.
0
 

Author Comment

by:allio
Comment Utility
Can you Disable the keyboard ? thru delphi
and enable it back ?

or better disable the keyboard with the mouse? or disable the mouse?
0
 

Author Comment

by:allio
Comment Utility
Can you Disable the keyboard ? thru delphi
and enable it back ?

or better disable the keyboard with the mouse? or disable the mouse?
0
 
LVL 2

Expert Comment

by:isstorr
Comment Utility
Just found some assembler routines to do a warm & cold reboot -

http://www.geocities.com/SiliconValley/2926/tpsrc/rebootcon.html
0
 
LVL 17

Expert Comment

by:inthe
Comment Utility
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.
0
 
LVL 17

Expert Comment

by:inthe
Comment Utility
ps,
reboots?
ExitWindowsEx() would be proper way ..
0
 
LVL 2

Expert Comment

by:isstorr
Comment Utility
y those routines use absolute addressing - not a great idea these days...
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
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;
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
At http://www.delphi3000.com/article.asp?ID=2262 can be found next article : 'Disable Keyboard and Mouse'
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
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 .
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
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
0
 

Expert Comment

by:lottol
Comment Utility
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);
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:lottol
Comment Utility
If you want to see programm manager, you can run it directly:

WinExec('taskmgr', SW_SHOW);
0
 

Expert Comment

by:classics
Comment Utility
Create a VxD and force the reboot from ring 0 code.
0
 
LVL 3

Expert Comment

by:lopem
Comment Utility
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.
0
 
LVL 44

Expert Comment

by:CrazyOne
Comment Utility
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.
0
 
LVL 17

Expert Comment

by:inthe
Comment Utility











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 ?

0
 
LVL 44

Expert Comment

by:CrazyOne
Comment Utility
>>>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. :>)
0
 
LVL 44

Expert Comment

by:CrazyOne
Comment Utility
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. :>)
0
 

Author Comment

by:allio
Comment Utility
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
0
 
LVL 44

Assisted Solution

by:CrazyOne
CrazyOne earned 100 total points
Comment Utility
I have not tested this lately so I don't remember how well it works or if it does work.

winexec(Pchar('rundll32 keyboard,disable'),sw_Show);
0
 
LVL 9

Expert Comment

by:ginsonic
Comment Utility
Good article '...block keyboard and mouse input ?'  http://www.swissdelphicenter.ch/torry/showcode.php?id=312
0
 
LVL 9

Accepted Solution

by:
ginsonic earned 100 total points
Comment Utility
function FuncAvail (VLibraryname, VFunctionname: string; var VPointer: pointer):
boolean;
var
  Vlib: tHandle;
begin
  Result := false;
  VPointer := NIL;
   if LoadLibrary(PChar(VLibraryname)) = 0 then
      exit;
   VPointer := GetModuleHandle(PChar(VLibraryname));
   if Vlib <> 0 then
   begin
    VPointer := GetProcAddress(Vlib, PChar(VFunctionname));
    if VPointer <> NIL then
       Result := true;
   end;
end;

8<-------------

procedure TForm1.Button1Click(Sender: TObject);
var
   xBlockInput : function(Block: BOOL): BOOL; stdcall;
begin
  if FuncAvail('USER32.DLL', 'BlockInput', @xBlockInput) then
  begin
   xBlockInput(true);  //Block
   Sleep(15000);       // 15 secounds delay to test
   xBlockInput(false); //Unblock
  end;
end;
0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
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.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://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.
http://www.experts-exchange.com/questions/Q.11410418.html
http://www.experts-exchange.com/questions/Q.20247100.html
http://www.experts-exchange.com/questions/Q.20290838.html
http://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
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://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
0
 
LVL 3

Assisted Solution

by:lopem
lopem earned 100 total points
Comment Utility
I found this, hope this help...
best regards...
Manuel Lopez (lopem)


I have been asked how to force Windows to reboot from within a Delphi program.  This is a simple API call,
needing just a single line of code:

                  ExitWindowsEx(EWX_REBOOT,0);

There are other parameter options that will allow you to achieve different results - to achieve those results just
replace the first parameter with the appropriate constant.  A full listing follows:

                 EWX_FORCE

Forces processes to terminate. Instead of bringing up the "application not responding" dialog box for the user,
this value forces an application to terminate if it does not respond.

                 EWX_LOGOFF

Shuts down all processes running in the security context of the process that called the ExitWindowsEx function.
Then it logs the user off.

                 EWX_POWEROFF

Shuts down the system and turns off the power. The system must support the power-off feature.

                 EWX_REBOOT

Shuts down the system and then restarts the system.

                 EWX_SHUTDOWN

Shuts down the system to a point at which it is safe to turn off the power. All file buffers have been flushed to
disk, and all running processes have stopped.

Chris Bray
Written by Chris Bray - http://www.verticalsoftware.co.uk
0
 
LVL 1

Expert Comment

by:Moondancer
Comment Utility
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
0
 

Author Comment

by:allio
Comment Utility
moondancer
i want to split the points to
100 to crazyone
100 to ginsonic
100 to Iopem

thanks
0
 
LVL 1

Expert Comment

by:pnh73
Comment Utility
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
0

Featured Post

What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now