Solved

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

Posted on 2003-11-24
6
231 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
  • 3
6 Comments
 
LVL 5

Accepted Solution

by:
snehanshu earned 63 total points
Comment Utility
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 62 total points
Comment Utility
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
Comment Utility
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
Comment Utility
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, Just open a new email message.  In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

771 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now