469,954 Members | 1,759 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,954 developers. It's quick & easy.

auto timeout for winform application

I need to have a auto timeout feature for a webform application(vb.net).
Basically, I want to close the application if the user does not have a
keyboard or mouse input after a specific period of time. Please help!

Dayne
Jul 21 '05 #1
9 2988
"Dayne" <d_**********@hotmail.com> schrieb:
I need to have a auto timeout feature for a webform application(vb.net).
Basically, I want to close the application if the user does not have a
keyboard or mouse input after a specific period of time.


There's no need to post this more than once. You already got an answer:

HOWTO track a user's idle time
<URL:http://www.codeproject.com/dll/trackuseridle.asp>

<URL:http://groups.google.de/groups?selm=...2MSFTNGP11.phx.
gbl>

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Jul 21 '05 #2
Hello Dayne,

Do you want to close the app if the user doesn't touch the App, or if the
user doesn't touch Windows?
There's a difference.

Let's say I use your app, then minimize it, and open up Excel. I type in
Excel for an hour. Should you app time out?
If not, then you need to hook the windows event. The article that Wayne
sent is appropriate.
If, on the other hand, you want to close because no one has touched your app
in an hour, then you can simply set a timer in your app and when you get
keystrokes or clicks, set the current datetime in a static location. When
your time goes off, check to see if "too long" has occured, and if so,
close.

One problem: it isn't clear if your app is ASP.NET or is a Windows forms
app. In your title, you way Winform, but in the text you say webform.

If it is a web form, you have a totally different problem.
--- Nick

"Dayne" <d_**********@hotmail.com> wrote in message
news:uY*************@TK2MSFTNGP12.phx.gbl...
I need to have a auto timeout feature for a webform application(vb.net).
Basically, I want to close the application if the user does not have a
keyboard or mouse input after a specific period of time. Please help!

Dayne

Jul 21 '05 #3
Use a javascript timer on the web client which should be reset each time a
user enters text or moves focus from one control to another, if the timer
event ever fires you can window.close()

HTH

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"Dayne" <d_**********@hotmail.com> wrote in message
news:uY*************@TK2MSFTNGP12.phx.gbl...
I need to have a auto timeout feature for a webform application(vb.net).
Basically, I want to close the application if the user does not have a
keyboard or mouse input after a specific period of time. Please help!

Dayne

Jul 21 '05 #4
"Dayne" <d_**********@hotmail.com> schrieb:
I need to have a auto timeout feature for a webform application(vb.net).

Web Forms or Windows Forms?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Jul 21 '05 #5
The title of the OP's post says Winform, but in the text he says WebForm

--
OHM ( Terry Burns ) * Use the following to email me *

Dim ch() As Char = "ufssz/cvsotAhsfbuTpmvujpotXjui/OFU".ToCharArray()
For i As Int32 = 0 To ch.Length - 1
ch(i) = Convert.ToChar(Convert.ToInt16(ch(i)) - 1)
Next
Process.Start("mailto:" & New String(ch))
--
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:ee**************@tk2msftngp13.phx.gbl...
"Dayne" <d_**********@hotmail.com> schrieb:
I need to have a auto timeout feature for a webform application(vb.net).

Web Forms or Windows Forms?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>

Jul 21 '05 #6
I am doing a winform application(desktop application). I want to close
the application if there is no key stroke between ( from my application
or any other ) a define period.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #7

I am doing a window application.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #8

Winform

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #9
Dayne,

Assuming it is a windowform, than I think that you can use something as this
beneath when it is a webform you can do as Terry told, in is almost the same
way as this. And please stay as Herfried told as well next time in the
original question thread.

\\\Need a webform and some controls however a button and a textbox as
minimum
Private WithEvents mytimer As New Windows.Forms.Timer
Private Sub Form1_Load(ByVal sender As Object, _
ByVal e As System.EventArgs) Handles MyBase.Load
doSet(Me)
End Sub
Private Sub doSet(ByVal parentCtr As Control)
Dim ctr As Control
For Each ctr In parentCtr.Controls
AddHandler ctr.Click, AddressOf eventfired1
AddHandler ctr.Enter, AddressOf eventfired1
AddHandler ctr.KeyDown, AddressOf eventfired2
doSet(ctr)
Next
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, _
ByVal e As System.EventArgs) Handles mytimer.Tick
Me.Close()
End Sub
Private Sub eventfired1(ByVal sender As System.Object, _
ByVal e As System.EventArgs)
eventfired()
End Sub
Private Sub eventfired2(ByVal sender As System.Object, _
ByVal e As Windows.forms.KeyEventArgs)
eventfired()
End Sub
Private Sub eventfired()
mytimer.Enabled = True
mytimer.Stop()
mytimer.Interval = 3000
mytimer.Start()
End Sub
///

I hope this helps a little bit?

Cor
Jul 21 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by zbcong | last post: by
1 post views Thread by Michelle | last post: by
3 posts views Thread by Woody Splawn | last post: by
24 posts views Thread by aam | last post: by
1 post views Thread by reidarT | last post: by
4 posts views Thread by jgamble | last post: by
4 posts views Thread by Smithers | last post: by
2 posts views Thread by Dean Slindee | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.