?
Solved

Artificial Ctrl Alt Del

Posted on 2002-04-19
31
Medium Priority
?
557 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 7
  • 5
  • 4
  • +8
31 Comments
 
LVL 11

Expert Comment

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

Expert Comment

by:ginsonic
ID: 6952791
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
ID: 6952841
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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 11

Expert Comment

by:robert_marquardt
ID: 6952865
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
ID: 6952887
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
ID: 6952892
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
ID: 6952898
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
ID: 6952919
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
ID: 6952922
ps,
reboots?
ExitWindowsEx() would be proper way ..
0
 
LVL 2

Expert Comment

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

Expert Comment

by:ginsonic
ID: 6953157
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
ID: 6953163
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
ID: 6953181
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
ID: 6953182
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
ID: 6953310
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
 

Expert Comment

by:lottol
ID: 6953375
If you want to see programm manager, you can run it directly:

WinExec('taskmgr', SW_SHOW);
0
 

Expert Comment

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

Expert Comment

by:lopem
ID: 6955351
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
ID: 6955530
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
ID: 6956179











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
ID: 6956733
>>>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
ID: 6957442
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
ID: 6958662
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 400 total points
ID: 6958724
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
ID: 6958855
Good article '...block keyboard and mouse input ?'  http://www.swissdelphicenter.ch/torry/showcode.php?id=312
0
 
LVL 9

Accepted Solution

by:
ginsonic earned 400 total points
ID: 6958859
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
ID: 6975827
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 400 total points
ID: 7002007
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
ID: 7022740
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
ID: 7145543
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
ID: 9003591
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

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses
Course of the Month8 days, 3 hours left to enroll

765 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