.NETGURU
Detecting PC inactivity
Messages   Related Types
This message was discovered on microsoft.public.dotnet.framework.windowsforms.
Responses highlighted in red are from those people who are likely to be able to contribute good, authoratitive information to this discussion. They include Microsoft employees, MVP's and others who IMHO contribute well to these kinds of discussions.
Post a new message to this list...

Ben (VIP)
Hi All,

I need to detect when the PC has been inactive for a set period of time.
This solution has to work on Windows 98 and up. I was looking for a way to
hook into global mouse and keyboard events, but I haven't found a way to do
it.

The IMessageFilter appears to only work at the Application level. Similarly
using SetWindowsHookEx with WH_MOUSE only listens at the application level,
and WH_MOUSE_LL isn't supported by Windows 98/ME.

Anyone have a solution to this?

Thanks,
Ben
Reply to this message...
 
    
Imran Koradia (VIP)
take a look at these:
http://www.codeproject.com/csharp/GlobalSystemHook.asp
http://www.codeproject.com/csharp/globalhook.asp

hope that helps..
Imran.

"Ben" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

Reply to this message...
 
    
Herfried K. Wagner [MVP] (VIP)
* "Imran Koradia" <Click here to reveal e-mail address> scripsit:
[Original message clipped]

In addition to that:

Managing Low-Level Keyboard Hooks in VB .NET
<URL:http://www.developer.com/net/net/article.php/11087_2193301_1/>

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Reply to this message...
 
    
Ben (VIP)
The first link (http://www.codeproject.com/csharp/GlobalSystemHook.asp)
proposes a solution that requires a c++ implementation to be called into c#,
and maybe this is the only way to do it, but it would be much nicer if there
was an entirely c# implementation.

The other links propose solutions that requires hooking
WH_KEYBOARD_LL/WH_MOUSE_LL, which microsoft
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindowshookex.asp) indicates are only available on NT/2000/XP.

Does anyone else have a c# solution that will work on 98, ME, 2000, and XP?

--Ben

"Herfried K. Wagner [MVP]" wrote:

[Original message clipped]

Reply to this message...
 
    
Imran Koradia (VIP)
As per this message:
http://tinyurl.com/6syna

I don't think you can have a completely managed solution to implementing
hooks that would work on windows 98/ME as well. You would most likely have
to resort to a language that allows you to create standard dlls (which would
exclude VB6 as well) such as C, C++, etc

Sorry - I know this isn't what you were expecting. Anyway, hope this helps a
bit..
Imran.

"Ben" <Click here to reveal e-mail address> wrote in message
news:Click here to reveal e-mail address...
[Original message clipped]

i/windowsuserinterface/windowing/hooks/hookreference/hookfunctions/setwindow
shookex.asp) indicates are only available on NT/2000/XP.
[Original message clipped]

Reply to this message...
 
    
Ben (VIP)
Thank you very much for your help Imran.

Writing a custom unmanaged dll was the only I had found to do it in my
googling, but I was hoping against hope that someone on the boards had a nice
way of doing it.

Thanks again,
--Ben

"Imran Koradia" wrote:

[Original message clipped]

Reply to this message...
 
 
System.Windows.Forms.IMessageFilter




ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
Ad


Need Dot Net Interview Questions?
Ask ExamGuru, Inc. for advice and help on Passing .Net Interviews
.Net Projects
Best-of-breed application framework for .NET projects, developed by ExamGuru, Inc. and ExamGuru IT
Free .net Help
Commission ExamGuru, Inc. and his team for your next bespoke software project
FogBUGZ
The only bug tracking system carefully crafted with one goal in mind: helping teams create great software.
Awesome Tools
If you don't know about these, you're missing out... IT Certification Questions
IT Interview Questions
Free Oracle 10g Training
MCSE Boortcamp
Cisco Study Guides
Cheap Study Guides
Exact Questions
Dot Net Interview Questions
Oracle OCP
Cheap Travel
Designer Perfumes - Wholesale Prices
Free Programming Tutorials
 
ExamGuru IT Solutions - .Net Guru is owned and operated by ExamGuru, Inc., the man behind .Net Guru. If you're in the market for bespoke software or software consultancy, why not get him and his highly trained team to help? - www.examguru.net/ITCertification
 Copyright © ExamGuru, Inc. 2001-2006
Contact Us - Terms of Use - Privacy Policy - www.dot-net-guru.com - www.examguru.net - www.oraclesource.net - www.itinterviews.net - www.examguru.net/ITCertification