PC Booking Application?

dragonflare

Member
Joined
Oct 11, 2011
Messages
6
Programming Experience
1-3
Hello people,

I am making a vb.net client application that works with a php based website where users can reserve a pc for themselves at a certain day and a certain time.
I have made the application in such a way that upon logon, it queries the database and finds the person who booked pc at this time and compares the username to the person logged on. If it matches a welcome screen is showed with additional options. Else a window is shown which says "This PC is already booked. You will be logged of in 10 seconds".

The problem i am facing is, i have coded the close button to logoff since i dont want user to bypass this part, but yesterday i saw that if i close the app directly from taskbar (processes) it just closes....... without logging him off...

How can we code or is there anything we can do that, even if he closes the application through task bar there is still an instant log off?

Thanks a lot for all help!
 
Hey mate,

thanks for the quick reply. However i think my question was misunderstood :|

Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As FormClosingEventArgs) _
Handles Me.FormClosing

System.Diagnostics.Process.Start("shutdown", "-l")

End Sub

I had done that already and it logoffs perfectly when user closes the application through the red cross button. But what i want to do is still log it off even if they kill the .exe process for example .... sample.exe -> end process through the task manager. I tried doing that and the program just shuts down without logging off... Now this would be a problem when some users who like to fiddle around would get to know of this flaw they would just keep closing it through the task manager so that they dont get logged off and have a free pc!

Thanks again for all help
 
A graceful close from task manager will be detected, it is one of the close reasons.
A kill process is immediate and can not be detected, no code can execute after process has been stopped. A light bulb can't stay lit when its power source is shut.
 
What you could have is two processes monitoring each other.
 
Back
Top