Link to home
Start Free TrialLog in
Avatar of koger
koger

asked on

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.
Avatar of inthe
inthe

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
Avatar of koger

ASKER

Ok, but i would prefer the other sollution, that detects the user activity
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.
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).
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.
ASKER CERTIFIED SOLUTION
Avatar of inthe
inthe

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
hello
did you try it?
it seems to work quite well.
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 ?