473,474 Members | 1,669 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to detect if the mouse is inactive?

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

Jun 9 '06 #1
3 2867
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.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Iosy" <io**************@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
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

Jun 9 '06 #2
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:
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.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Iosy" <io**************@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
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


Jun 12 '06 #3
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
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

"Iosy" <io**************@hotmail.com> wrote in message
news:11*********************@f14g2000cwb.googlegro ups.com...
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:
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.
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Iosy" <io**************@hotmail.com> wrote in message
news:11**********************@i39g2000cwa.googlegr oups.com...
> 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
>

Jun 12 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: selowan | last post by:
Hi, In VB6 Pro SP5, I have a form that contains an MSFlexGrid and a few other textboxes and comboboxes. I am using the technique from MSDN article Q241355, which describes how to tab and edit in...
2
by: Eitan | last post by:
Hello, I am creating a new window class based on CWnd. I am placing it on the View (CFormView). How can I get the notification or any other indication that the cursor/mouse is not on this...
6
by: Perquiaga | last post by:
Hi to all I have to detect the mouse presence and disconection if occurs to give alerts. I'm using VB .NET, if somebody can help i'll apretiate it.
2
by: Sam | last post by:
Hi, I can't figure out how to detect when my mouse cursor leaves a panel control. It should not trigger the event (or do anything) when the mouse leave the panel but still is over a control that...
0
by: MIke Kansky | last post by:
I need to detect when user's computer goes to idle mode. I also need to detect when user's computer comes back from the idle mode. I have an application running in Sys Tray that should let the...
3
by: squeak | last post by:
Hi there, I'm new to VB2005 so its probably a very simple answer too! But i just can't think how to do it... Basically i need to detect mouse (and preferably keyboard) movement and kepresses...
0
by: Chris | last post by:
Hi , I am having problems with mouse positioning and have code in the mouse up and mouse down events using C# in VS 2005. I am trying to draw a rectangle on top of a picture box image. If I...
12
by: Phil | last post by:
I can check for MdiChildren.Length=0, but which event handler should I put this in to detect when a child window is closed? TIA Phil.
2
by: Mohit | last post by:
Hi all, I am working on a windows application with a list view on a form. Now I wanted to show hand cursor when mouse is over list view item and default(arrow) cursor at other places. List...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.