baolsen

I have a program that will lock my computer at a specified time. I would like to also be able to unlock my computer at a certain time. I don't know if there is an API or code that will allow me to input my username and password to unlock windows. Any ideas would help, thanks



Re: Visual Basic Express Edition Logon to Windows at Given Time

ReneeC

Viruses would LOVE such an api wouldn't they






Re: Visual Basic Express Edition Logon to Windows at Given Time

baolsen

I would think that if you had to have your user name and password to unlock windows in the first place that putting them in your code instead wouldn't be that much different than putting them in the fields manually. What I am looking for is something like: UnlockWorkStation(UserName, Password).





Re: Visual Basic Express Edition Logon to Windows at Given Time

js06

I can see what you are trying to do but windows already has this built in as you said.

So the question would be, why do you need to "redo" this function

Why not check to see if the user is authenticated to control who you give permissions to

I'm just confused on why you would want to add another password login when there is one there already.

Maybe you could explain what you are after here better, otherwise i don't think anyone will give you much help

It almost looks like you want to handle the changing of users and passwords from a remote computer at any time.

If you are a computer administrator then you should be able to handle your workstations already.






Re: Visual Basic Express Edition Logon to Windows at Given Time

baolsen

Your right, Let me explain it a little better. With the code below I can log off of my workstation everyday at 4:30, which is nice because I always forget to log off at the end of the day when I go home. This way wether I remember or not the computer locks itself. I know that with windows I can lock it after a certain amount of time but I am always walking away from the computer and it can get repetative always unlocking windows, besides the code to lock it at a certain time wasn't that difficult.

An added level of convienience would be to have my computer ulocked and ready when I walk in at 8:00am. Really it an issue of convienience, every night when I leave the office my computer is locked without me having to remember or do anything.

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

txtMin.Text = "30"

txtHour.Text = "4"

optPM.Checked = True

End Sub

Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick

'CURRENT TIME:

If System.DateTime.Now.Hour > 12 Then

sysHour.Text = System.DateTime.Now.Hour - 12

lblAMPM.Text = "PM"

Else

sysHour.Text = System.DateTime.Now.Hour

lblAMPM.Text = "AM"

End If

sysMin.Text = System.DateTime.Now.Minute

sysSec.Text = System.DateTime.Now.Second

'STOP TIME

Dim varHour As String

If optPM.Checked = True Then

varHour = txtHour.Text + 12

Else

varHour = txtHour.Text

End If

If System.DateTime.Now.Hour = varHour And System.DateTime.Now.Minute = txtMin.Text And System.DateTime.Now.Second = txtSec.Text Then

Shell("rundll32 user32.dll,LockWorkStation", vbNormalFocus)

Me.Close()

End If

End Sub






Re: Visual Basic Express Edition Logon to Windows at Given Time

js06

Well i'm afraid i can't help with this one but i was wondering

What happens when you don't show up to work one day or you're late and your computer logs on letting anyone access it

Then later on you find "things" on your computer that can get you in trouble.

Like emails that were sent or files that are of pornographic nature. You never know what can happen.

Just my opinion but what would be the point of having a password at all if your going to let it open on it's own.

Unless you like to gamble

Maybe your not that worried about it, but then why lock it

I guess what i am trying to say is why don't you look at other ways to handle this.

Or maybe you can just take about 20 seconds at the beginning of the day to type in your password and login.

You've already got the best part figured out - not having to remember to log off (that's a great idea)

You can't forget to log in.

Anyway, just my opinion

good luck with it, i hope you get it figured out.






Re: Visual Basic Express Edition Logon to Windows at Given Time

baolsen

I appreciate it. When I hit a problem that I can't solve it bugs me, I hardly ever post a question but i've been researching this one for a while. ie, now its more about trying solve it.

The only people that I am really concerned about is the night crew. In the event that I don't work the next day another part of the code has a disable button but durring the day the night crew isn't there anyway and its watched, that night it will lock again. Other than the night crew I'm really not concerned.






Re: Visual Basic Express Edition Logon to Windows at Given Time

baolsen

I still have not come to a resolution on this problem that I am having. It may not be possible. but if there are any ideas they would be helpfull. Thanks




Re: Visual Basic Express Edition Logon to Windows at Given Time

gshkvinod

hi ur post was help frl and can u tell me what is the code for shutting down or restarting the windows using the following shell command

Shell("rundll32 user32.dll, "






Re: Visual Basic Express Edition Logon to Windows at Given Time

baolsen

It is in the same family as

Shell("rundll32 user32.dll,LockWorkStation", vbNormalFocus

I'll see if I can find it for you. You can do anything, like restart, hiberntate, shutdown, logoff. ect






Re: Visual Basic Express Edition Logon to Windows at Given Time

baolsen

Here is a sample vb program with source and explanations that does everything that you want. If I remember right it is where I got a lot of my ideas:

http://www.c-sharpcorner.com/UploadFile/thiagu304/desktopfunctions02112007140806PM/desktopfunctions.aspx

Here are a couple more ideas:

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=1914305&SiteID=1

http://forums.microsoft.com/MSDN/ShowPost.aspx PostID=366137&SiteID=1