How to detect if the mouse is inactive?

I

Iosy

Hi all,

I'm working in a application where I need to detect when the mouse is
inactive outside my form. I mean, I want to detect if the mouse hasn't
move in the last X seconds (2 por example) and in case that it hasn't,
show a menu.

Thanks
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

You will have to make a system hook and handle the mouse event, you can set
a flag when the mouse is moved storing the DateTime.Tick
you then set a timer that check every X seconds when was the last handled
event.
 
I

Iosy

Hi Ignacio,

I've been working with C# for a short time and I'm not sure if I've
understand your explanation correctly. Could you write a short example
of what you have explained?

Thanks

Ignacio Machin ( .NET/ C# MVP ) ha escrito:
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,


Unfortunately I do not have one around. You can google for "global hook" or
system hook use group:microsoft.public.dotnet.* to make sure that the
answers are related to .net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top