Simulate Ctrl+Alt+Del in delphi

AvatarusChilensis
AvatarusChilensis used Ask the Experts™
on
Hi, I want to simulate an Ctrl+Alt+Del keystroke for a remote control app. I try the next code but it doesn't works:

procedure TForm1.Button4Click(Sender: TObject);
begin
keybd_event(VK_CONTROL,0,0,0);
keybd_event(VK_MENU,0,0,0);
keybd_event(VK_DELETE,0,0,0);
keybd_event(VK_DELETE,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_MENU,0,KEYEVENTF_KEYUP,0);
keybd_event(VK_CONTROL,0,KEYEVENTF_KEYUP,0);
end;

thx
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Sorry, this sequence is protected and cannot be generated with keybd_event.

Author

Commented:
is there any other way to generate this action?
AFAIK not without driver.
Why Diversity in Tech Matters

Kesha Williams, certified professional and software developer, explores the imbalance of diversity in the world of technology -- especially when it comes to hiring women. She showcases ways she's making a difference through the Colors of STEM program.

Author

Commented:
thanks, but what kind of driver could it be??
Do you need to reboot or do you really need to simulate the CTLR-ALT-DEL?

Author

Commented:
simulate Ctrl+Alt+Del to pop up the Close Session or Block workstation on Windows NT/2000
To lock computer try to shell execute something like:

%windir%\System32\rundll32.exe user32.dll,LockWorkStation

or use this code (very easy isn't it), it returns 0 if something goes wrong:

procedure TForm1.Button1Click(Sender: TObject);
begin
  LockWorkStation;
end;

To logoff:

  http://www.swissdelphicenter.ch/en/showcode.php?id=168

Hope it helps! :-)

Author

Commented:
thx

Author

Commented:
that's good enough
;)

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial