Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Auto Start Windows App. Service, Registry, Scheduled Task????

Status
Not open for further replies.

BenSC

Technical User
Jul 24, 2001
43
GB
Dear All,
I have an application that monitors keystrokes to dictate how long a user has been idle. Once a time-limit is reached a modal .Net form pops up and locks the keyboard until biometric authorisation is provided.

My question is regarding how to get the timer application:
1 - Automatically starting at logon
2 - Automatically RE-starting if a user ends the application via the Task Manager

I've read a lot about windows services, registry keys and scheduled tasks, but have only succeeded in completely confusing myself.
I was leaning towards a service as they can be set not to stop, thereby ensuring that the timer app will be restarted when the service realises that it isn't running. However, I've never worked with services before so don't actually know how to achieve this.

Anyway help and advice would be gratefully received.
Ben Cooper
 
Hi Ben.
I don't know a lot (ok, really anything) about creating services, but hopefully I can provide you with a little guidance.

A service would probably be the best choice. It can run at startup and can restart itself if it terminates. Those properties are set in Services > Service Properties > Recovery.

What you should be able to do is create a standard program that does what you want it to do and then INSTALL it as a service. I'm not sure how to do this exactly (sorry I'm no help on that), but I know I've seen it done. There's supposed to be a command-line utility that can create a service. You should be able to install it with recovery options already set. You will want to "Restart the service" after the first, second, and subsequent failures. You will also want to restart it after zero minutes (that should start it immediately on termination/failure).

I hope this has helped you some. You might try these pages for additional info:

(This may be an easy to way to install it into the Service management console, where you can then change the startup and recovery settings):
 
Right after I posted that reply, I noticed someone had replied to one of my questions. It has some info you might find useful:

"
With everything that you need it to do, you should use a Windows Service instead of a Console. The Windows Service provides you with all the abilities you want to provide (persistance, reason for stopping of service)

The quick one line answer is to create a new project using the Windows Service template in Visual Studio. That will get you started. However, this will walk you through how to get it working and installed...

"

Thanks to macleod1021 for that one!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top