[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

After an idle period, shutdown a windows machine as NT service.

Posted on 2003-11-24
6
Medium Priority
?
240 Views
Last Modified: 2010-04-05
Hi! I´m trying to make an application that can do shutdown a machine running windows 2000 or xp, after a certain idle period of time. But i´de like that the application running as NT Service. The goal is running without having to enter on session time. Can it be possible? And how?
Thanks All
0
Comment
Question by:frizze
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
6 Comments
 
LVL 5

Accepted Solution

by:
snehanshu earned 252 total points
ID: 9815968
frizze,
  I am working on a utility that monitoris the Idle time of the PC. The way I am doing it is to hook to keyboard and mouse events to find out how long the system was idle (using a service). I check it periodically (using a timer) and save the idle time.
  If that helps, read on...
  I have asked a few questions at EE for doing that and you could have a look at those. There are two ways you could do it:
1) Using Journal hooks
2) Using individual Keyboard/mouse hooks
  When I asked here, I was recommended that for longer periods of time, non-journal hooks are better. But perhaps journal hooks are simple. So, you could decide on what you want.

Links:
  My journal hook service code is posted in this Q:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20794138.html

This is where I got the code for a DLL that creates Kbd hooks (non-journal):
http://www.swissdelphicenter.ch/torry/showcode.php?id=1722

This is for using the DLL described above from the service:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20750612.html

And this is the debate of what to use journal or other hook:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20750833.html

  I am asking you to chase a lot of links, but doing that gave me a better understanding of what I wanted. hope it works the same way for you too.
  Cheers,
...Snehanshu
0
 
LVL 7

Assisted Solution

by:sftweng
sftweng earned 248 total points
ID: 9832770
An easy way to detect that a machine is idle is described in:
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20810017.html

Do you need assistance with running as a service and forcing shutdown?
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 9849095
frizze,
  I have posted some code at
http://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20810017.html
  It shows how you could use a timer and Journal hook to perform some action on inactivity.
  The code is not for a service, but you can easily make a service out of it. Do let me know if you need any help with converting the code there into a service.
  Cheers!
...Shu
0
 
LVL 5

Expert Comment

by:snehanshu
ID: 9849110
0

Featured Post

Ask an Anonymous Question!

Don't feel intimidated by what you don't know. Ask your question anonymously. It's easy! Learn more and upgrade.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

656 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question