views:

21

answers:

1

Hi, I need to get the idle time of the device in one of my windows mobile app. I tried all the way i couldn't get it. could Any one post the code for it..

Thanks in advance.

A: 

To get it to work, you'll need the GetIdleTime() function from coredll.dll.

To access it you can use a P/Invoke command which is stated here:

[DllImport("coredll.dll")]
static extern int GetIdleTime ();

Also you should note that some devices don't support this functionality and return a MAXDWORD instead (see GetIdleTime() description in block Return Value).

Oliver
i used the same but, when i call that method inside my timer control event which is keep on incrementing even though i am not doing any thing.
Nagaraj
Maybe i misunderstood your comment, but GetIdleTime() will increase if you do nothing, hence the name.
Oliver