Tod,
Sure, you'll need the OpenNetCF framework though...
1: you'll need a global variable that stores the time of the last action.
Either a static that's globally aviable or a singleton object instance that
contains the date time object...
2: create a message filter class which checks all message coming through the
app and sets the time of last action variable to now, as follows:
using System;
using System.Windows.Forms;
using OpenNETCF.Windows.Forms;
using Microsoft.WindowsCE.Forms;
namespace ScannerApp
{
/// <summary>
/// Summary description for MessageFilter.
/// </summary>
public class MessageFilter : IMessageFilter
{
// resst the time out for user log-ins
public bool PreFilterMessage(ref Message m)
{
if ( m.Msg != 275 ) // message of time out event
AppData.TimeOfLastAction = DateTime.Now;
return false;
}
}
}
3: Now in your Main method, you need to hook in this message filter so that
anything that happens first goes through your filter... ApplicationEx is a
OpenNetCF Application extended object
MessageFilter msgFlter = new MessageFilter();
ApplicationEx.AddMessageFilter ( msgFlter );
ApplicationEx.Run(new FormMain());
4: Finally, you'll need to have a time on the main form to check this
data... I'll leave this to you as all you need is a timer object that goes
off and simply check if the time between DateTime.Now and the time of the
last action is greater than the the time out you'd like (say 5 minutes),
then fire off your screen saver or log the user out or whatever...
Let me know if you need any more info.
Thanks.
Dan