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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to determin the inactivity time of the computer

Status
Not open for further replies.

FaneDuru

Technical User
Jul 15, 2002
141
RO
If I wont to do something after a specific time of computer inactivity how can I determin this time ?

Thanks in advaance,
Fane Duru'
 
I'd say you need to be more specific as to what your goals are here if you hope to get any answers. This question is too vague.

I hope you find this post helpful.

Regards,

Mark
 
there are power API calls that might be of interest
 
Sorry for the delaied clarification...
I need the time of inactivity like the one after the screen saver starts.

Thanks,
Fane Duru'
 
I don't think you will be able to get that granular. As soon as you query I think it will alter the inactive time.

I hope you find this post helpful.

Regards,

Mark
 
There is a [tt]GetLastInputInfo()[/tt] in [tt]user32.dll[/tt] that will return the time of the last user input (keyboard or mouse I believe) in milliseconds since last reboot. This requires Win2K or later.

There is also a window message broadcast to all windows relating to expiration of the screen saver inactivity interval. I can't recall the name and value of this message right now. Probably a WM_SYSCOMMAND with an argument like SC_SCREENSAVE. Ahh, I think that's it, see: How to write a 32bit screen saver.

Neither of these is directly useful from a WSH or HTA script however. You'd need a code component created using VB or C++ to make the API calls needed, and you'd need to intercept window messages to use the other approach.

Maybe someone else has another answer, possibly via WMI?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top