Hi,
Just some untested idea, get all keyboard and mouse action trough an
implemented IMessageFilter.
Class MyMessageFilter
------------------------
public class MyMessageFilter : IMessageFilter
{
public int TimerClicks_;
MyMessageFilter (MainForm frm)
{
TimerClicks_ = 0;
}
public bool PreFilterMessage(ref Message m)
{
if ( (m.Msg >= 0x200 && m.Msg <= 0x20D)) ||
(m.Msg >= 0x100 && m.Msg <= 0x108) )
{
// Console.WriteLine("Keyboard or Mouse msg: " + m.Msg);
TimerClicks_ = 0;
}
return false; // don't block messages
}
}
Class MainForm
----------------
public class MainForm : Form
{
// put timer on form, interval to e.g. 20000 (20sec)
private MyMessageFilter MessageFilter_;
private HideableForm frmHideable_; // this is the form which
auto-hides
MainForm()
{
frmHideable_ = new HideableForm();
MessageFilter_ = new MyMessageFilter();
Application.AddMessageFilter( MessageFilter_ );
// other stuff
}
timer-eventhandler()
{
++MessageFilter.TimerClicks_;
if (MessageFilter.TimerClicks == 30) // 30*20sec = 10min
{
Timer.Stop();
frmHideable.Hide();
}
}
void ShowHideableWnd()
{
Timer.Start();
frmHideable.Show();
}
}
HTH
greetings
"Bob Allen" <bo*@324pm.com> wrote in message
news:Ok*************@tk2msftngp13.phx.gbl...
I am working on an application that needs to timeout because of sensitive
information being displayed on the screen. Is there a way to flag the
application that nothing has happened for x number of seconds like a
screen saver would do? I have looked at using the mouse move events and the key
stroke events but i have so many controls in the app that this would be
very time consuming. So before undertaking this i was going to see if anyone ha
s a better idea?
Thanks;
Bob;