Inactive application

  • Thread starter Thread starter Pohihihi
  • Start date Start date
P

Pohihihi

Hello,

How to find for how long an application is not active, e.g. Outlook or some
other application. To add to the problem, how to find from inside of my
application for how long it was in-active. I do not want to use Timer. Is
there a way in windows or an API for that?

Thanks,
Pohihihi
 
What does an "inactive application" mean? Outlook polls for new mail even when the user is not directly interacting with it

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<[email protected]>

Hello,

How to find for how long an application is not active, e.g. Outlook or some
other application. To add to the problem, how to find from inside of my
application for how long it was in-active. I do not want to use Timer. Is
there a way in windows or an API for that?

Thanks,
Pohihihi
 
I guess what I mean was no activity by the user on the application (e.g. he
is not using computer for sometime).
 
Hi,

From what I remember from a Jeffrey Richter's book on Windows, the system
tracks UI messages sent to an application, and if there was no mouse and
keyboard messages for some time, the application priority could be lowered
in favour of foreground applications. So, a timer, in one way or another, is
required. I am not sure whether a ready-made API call exists telling you how
long an application has not been receiving user input, but you can implement
this yourself by keeping track of the user input messages.

I also think IM applications (ICQ, MSN Messenger etc.) use a similar
approach for automatically setting your status as "Away".

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
 
Hi,

I'm not sure if one can get this piece of info for a particular application,
but if it goes for the whole system there is an API for that. Look at
GetLastInputInfo. I think it is has no managed version or at least I don't
know of any.


--
HTH
Stoitcho Goutsev (100) [C# MVP]


Dmitriy Lapshin said:
Hi,

From what I remember from a Jeffrey Richter's book on Windows, the system
tracks UI messages sent to an application, and if there was no mouse and
keyboard messages for some time, the application priority could be lowered
in favour of foreground applications. So, a timer, in one way or another,
is required. I am not sure whether a ready-made API call exists telling
you how long an application has not been receiving user input, but you can
implement this yourself by keeping track of the user input messages.

I also think IM applications (ICQ, MSN Messenger etc.) use a similar
approach for automatically setting your status as "Away".

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx

Pohihihi said:
I guess what I mean was no activity by the user on the application (e.g.
he is not using computer for sometime).
 
Back
Top