?
Solved

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

Posted on 2003-11-24
6
Medium Priority
?
238 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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…
Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses

752 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