By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,204 Members | 1,360 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,204 IT Pros & Developers. It's quick & easy.

Programatically bypass CTRL + Alt + Del on restart?

P: 5
hi,

when i ask my program to restart the PC by Code ((Shell "Shutdown -r -f -t 0"))

it's open again up to the login windows

I need the code which allow me to send the ctrl+alt+Del to open the windows to complete my instantiation and running the program

can anyone help me.

thanks
Sep 3 '07 #1
Share this Question
Share on Google+
12 Replies


Expert 5K+
P: 8,434
I think the whole reason MS used the Ctrl-Alt-Del sequence at startup was to prevent programs from doing that without user intervention. Or to put it another way, I don't think you can.

I could be wrong, of course.
Sep 4 '07 #2

pureenhanoi
100+
P: 175
hi,

when i ask my program to restart the PC by Code ((Shell "Shutdown -r -f -t 0"))

it's open again up to the login windows

I need the code which allow me to send the ctrl+alt+Del to open the windows to complete my instantiation and running the program

can anyone help me.

thanks
You can restart windows by code without sending "Ctrl+Alt+Del" combination key.

Declare Function ExitWindowsEx Lib "user32" (ByVal uFlags As Long, ByVal dwReserved As Long) As Boolean
Public Const EWX_SHUTDOWN = 1
Public Const EWX_REBOOT = 2
Public Const EWX_LOGOFF = 0

To restart window:
Dim ret As Boolean
ret = ExitWindowsEx(EWX_REBOOT,0)
Sep 4 '07 #3

Expert 5K+
P: 8,434
You can restart windows by code ...
Are you saying this will make Windows restart and log on again automatically, without user input?
Sep 4 '07 #4

P: 5
Are you saying this will make Windows restart and log on again automatically, without user input?

Thanks for all of u

I mean really that reopen the windows automatic after I send the parameters with the User and Password,

As if you open the computer from Symantec pcAnywhere or Logmein.
I rather if you can visit www.Logmein.com to know what I am looking for

ex. I need code to let me open the windows from the user and password as when u press Ctrl+ alt+ del when you login (with domain ) not a sample user

best wishes
Sep 4 '07 #5

P: 21
I mean really that reopen the windows automatic ...
Surely any program you have running will be killed when you restart the pc...? So your code won't be running even if you could send ctrl-alt-del?
Sep 5 '07 #6

pureenhanoi
100+
P: 175
Are you saying this will make Windows restart and log on again automatically, without user input?
There is no way to logon automatically after restarting Windows. After restarting, Windows need user input Username and password to complete logon. If your computer has only one active user (except Administrator and Guest - thats often disabled), and this user has not password protected, the windows will automatically logon to this account. But if the windows has more User, it cant be logged on untill has user input.
If you want keep program still running, there is one complexibility technique that store all ram memory into hard disk. The next time windows logged on, you must manually copy data from harddisk into ram memory, so the program continue running. ( This is complexibility technique, so there is no more people can do that.)
If you just want open again your program after restarting windows (do not keep its running status), so the Setup program must store a Key in to Registry (at: HKLM\Software\Microsoft\Windows\CurrentVersion\Run ). This key has type of String, and its value must be the full path to Executeable file (you maybe want it point to your program). If you want your program continue running at startup, so do nothing, otherwise, remove this key at the first running of application.
Note: with this method, your program just be opened after the windows logged on and it runs in the starting point ( cannot keep running status ).
Dont try logon to windows without user input. Microsoft will not give you permission.
Sep 6 '07 #7

Expert 5K+
P: 8,434
There is no way to logon automatically after restarting Windows. ...
That was my point. The OP was asking how to bypass the manual logon process. I didn't think you could.
Sep 6 '07 #8

Expert 5K+
P: 8,434
... Dont try logon to windows without user input. Microsoft will not give you permission.
Yeah. Even when Windows Update installs an update and reboots, you have to go through the usual logon process. If MS won't even let themselves do it...
Sep 6 '07 #9

pureenhanoi
100+
P: 175
Yeah. Even when Windows Update installs an update and reboots, you have to go through the usual logon process. If MS won't even let themselves do it...
Of course they can do. But they don't do that. Windows Update often takes a long time to download and install into machine. Imagine that, you let Windows automatically download and install the update, meanwhile, you go out for a cup of coffee. When you come back, the update process has completed and Windows automatically logged on. There may be many users who can use your computer and do things that are harmful to your computer.
Of course, hackers can use some techniques to logon to the computer without knowing your password. But that's Microsoft's security. Windows is their product and they know how to log on without user input.
You were wrong if you said that: "MS won't event let themselves do it"
Sep 6 '07 #10

P: 6
when i ask my program to restart the PC by Code ((Shell "Shutdown -r -f -t 0"))

it's open again up to the login windows

I need the code which allow me to send the ctrl+alt+Del to open the windows to complete my instantiation and running the program
Hi mfibrik,

This isn't an exact answer to what you've asked. As others have mentioned, being able to bypass Ctrl+Alt+Del without action from a person would be a security flaw. Am I right however, in assuming that what you're really trying to do is get a program to start up automatically when you restart a computer?

That can be done in a number of ways.

1. Create a windows service to start the app. You could use a method like the one described here, which lets you create custom services for applications: http://www.tacktech.com/display.cfm?ttid=197

2. Configure an account to log in automatically, then write a script (Windows logon or startup) to start the program then lock your computer so it isn't sitting there logged in.

For autologon there are two methods here:
http://windowsxp.mvps.org/Autologon.htm

The first one worked fine for me when I tested it. I made an account called AutoLogon to test it with first:
Click Start, Run and type CONTROL USERPASSWORDS2, and click Ok. Select the user account from the list (the account to which you want to automatically logon). Uncheck Users must enter a user name and password to use this computer option, and click Ok. Type the user account password and complete the process.
You can always log off the account and log into another, once you've set this up. Also, you can hold Shift while Windows is loading to cancel the autologon.

Here's an example script that starts Notepad (replace with the path to your application), then locks your computer. Copy this into a text file, save it as something like loadAppAndLock.vbs, then put a shortcut to it in the Startup folder for the account that will log on automatically. Alternatively, you could just put a shortcut to your application in the Startup folder too and ommit lines 10, 11, 15 and 16.

Expand|Select|Wrap|Line Numbers
  1. ' loadAppAndLock.vbs
  2.  
  3. ' Opens APPLICATION_NAME then locks the workstation.
  4. ' Author: Chris Fry, Canberra, Australia
  5. ' 25th October, 2007
  6. ' -----------------------------------------------------'
  7. On Error Resume Next
  8.  
  9. 'Change this to your application path
  10. CONST APPLICATION_NAME = "C:\WINDOWS\system32\Notepad.exe"
  11.  
  12. Set objShell = CreateObject("Wscript.Shell")
  13.  
  14. 'Start application
  15. objShell.Run APPLICATION_NAME
  16.  
  17. 'Lock computer
  18. objShell.Run "%windir%\System32\rundll32.exe user32.dll,LockWorkStation"
  19.  
  20. 'End of loadAppAndLock.vbs
  21.  
One concern with this method is that there is a period of time between when the logon happens and the lock where your computer will be logged on and presumably unattended. Do some tests and decide if it's appropriate for your situation. For me it's about 5 seconds.

Add a post if you'd like any further clarification.

Hope that helps,

Chris Fry
Canberra, Australia
Oct 25 '07 #11

Expert 5K+
P: 8,434
Thanks for the info, Chris. I'm sure many of us (myself included) will find it useful.
Oct 25 '07 #12

P: 6
A couple of minor corrections - I tried the "shift" thing to stop auto logon, but it didn't work for me :-)
It probably either only works with the second auto logon method on the site I referenced using the Tweak UI PowerToy (I haven't tried that) or requires a PS2 keyboard.

Also, the omissions to get rid of the application start up should have been lines 9, 10, 14 and 15.

Chris
Oct 25 '07 #13

Post your reply

Sign in to post your reply or Sign up for a free account.