|
-
Feb 2nd, 2011, 04:12 PM
#1
Thread Starter
Addicted Member
[RESOLVED] How to Push Ctrl+Alt+Delete programatically?
Well, the title says it all this time. After I click "yes" on a msgbox,
I want to launch the Windows Logon Screen that I can normally launch by pushing Ctrl+Alt+Delete,
so how would I do this programatically, or if there's any way to launch that Windows Logon Screen I wouldn't mind.
-
Feb 2nd, 2011, 05:58 PM
#2
Addicted Member
Re: How to Push Ctrl+Alt+Delete programatically?
Method 1:
You can just like use a shell command and run "winlogon.exe"
Like this:
Shell("C:\Windows\winlogon.exe")
I'm not sure where winlogon is to be exact, so just run a search in My Computer to see where it is and put the location of it there. Test it by double clicking it to see if the windows logon screen comes up, and if not, find it on google how to run the windows logon screen and the Shell command will automatically run it for you. So now you know how to run it in vb.net, you just need to know which file to run.
Note that if you have a space in your location path (e.g. Program Files)
Between the m and F there is a space right, so you'd need to do this:
Shell("""""C:\Windows\winlogon.exe")
Putting "" in front of the location lets the shell command know that we do not need a title for the window. It's just a shell thing, its complicated for me to explain.
If that ^ doesn't work try this:
Shell(""""" C:\Windows\winlogon.exe")
Method 2:
This is the command line code to invoke the logon screen:
rundll32 user32.dll,LockWorkStation
To run this command in vb.net, do this:
Dim psi As Object = New ProcessStartInfo
psi.FileName = "cmd.exe"
System.Diagnostics.Process.Start(psi)
SendKeys.Send("cd C:/")
SendKeys.Send("rundll32 user32.dll,LockWorkStation")
Try that and see if it works.
Last edited by zero_coke; Feb 2nd, 2011 at 06:11 PM.
-
Feb 2nd, 2011, 06:13 PM
#3
Thread Starter
Addicted Member
Re: How to Push Ctrl+Alt+Delete programatically?
hmm, the second method would launch some command prompts, not more than that, while winlogon.exe won't do anything if I open it, it's located in the system32 folder btw.
-
Feb 2nd, 2011, 06:16 PM
#4
Addicted Member
Re: How to Push Ctrl+Alt+Delete programatically?
Yeah I'm trying to get second method to work because I know it works for sure when you type in "rundll32 user32.dll,LockWorkStation" into your command prompt so I just need to find a way to run it in vb.net hold on
-
Feb 2nd, 2011, 06:19 PM
#5
Addicted Member
Re: How to Push Ctrl+Alt+Delete programatically?
Okay, fixed it, use this after your msgbox result:
Code:
Shell("rundll32 user32.dll,LockWorkStation", vbNormalFocus)
-
Feb 2nd, 2011, 06:25 PM
#6
Thread Starter
Addicted Member
Re: How to Push Ctrl+Alt+Delete programatically?
 Originally Posted by zero_coke
Okay, fixed it, use this after your msgbox result:
Code:
Shell("rundll32 user32.dll,LockWorkStation", vbNormalFocus)
yep, works just as I needed it to work, thanks very much. Another longer way I found out was to create a batch file containing the "rundll32 user32.dll,LockWorkStation" and just executing it, but your method is easier and simpler, once more, thanks!
-
Feb 2nd, 2011, 06:33 PM
#7
Addicted Member
Re: [RESOLVED] How to Push Ctrl+Alt+Delete programatically?
No problem
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|