Detect user activity

Is it possible to detect how long a the pc activity has been idle.

or perhaps how to detect when the screensaver starts.
kogerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

intheCommented:
hi,
you can detect when screensaver is too start like:

procedure TForm1.AppMessage(var Msg : TMsg; var bHandled : boolean ); begin
  if((WM_SYSCOMMAND = Msg.Message) and (SC_SCREENSAVE = Msg.wParam) )then   Begin
    // bHandled := True; {this would disable the screensaver}
    end;
end;

Regards Barry
0
kogerAuthor Commented:
Ok, but i would prefer the other sollution, that detects the user activity
0
Igor UL7AAjrSenior developerCommented:
Hi,
What you mean: PC activity? - key pressing and mouse moving? Is it? And do you need to detect it from an another PC through network or in the yourself application or in the  application hidden from another users? I have some solutions, but I need the details.

Best regards.
Igor.
0
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

intheCommented:
the only other way is too write a keyboard and mouse hook, that after getting an event sets a timer into action until another key is pressed(or mouse is moved).
getcursorpos to see if mouse is moved and trap all keys.(maybe a hotkey compoent will suffice).
0
GurkanCommented:
Windows automatically checks system whether it is idle or not. All you have to do is set screen saver interval and catch the message activating it.
0
intheCommented:
ah found a easy way ;-)

this component is for this and simply uses a mesage hook to trap

if (Msg.message = WM_MOUSEMOVE) OR (Msg.message = WM_KEYDOWN) then
reset timer..

ftp://ftp.cdrom.com/pub/delphi_www/ftp/d20free/arprot.zip


Regards Barry
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
intheCommented:
hello
did you try it?
it seems to work quite well.
0
LeTayCommented:
The link mentioned ftp://ftp.cdrom.com/pub/delphi_www/ftp/d20free/arprot.zip
does not seem to exist anymore
Who can I get the component ?
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.