示例#1
0
        public Form1()
        {
            InitializeComponent();

            // set a filter for 5 seconds
            m_filter = new InactivityFilter(5000);
            m_filter.InactivityElapsed += new MethodInvoker(m_filter_InactivityElapsed);
            Application2.AddMessageFilter(m_filter);
        }
示例#2
0
 public Keytest3AKsdfForm()
 {
     InitializeComponent();
     initListView();
     _hwnd = new List <IntPtr>();
     _hwnd.Add(this.Handle);
     _hwnd.Add(this.listView1.Handle);
     Application2.AddMessageFilter(this);
     win32.AllKeys(true);
 }
示例#3
0
        public Keytest3AKwm61()
        {
            InitializeComponent();
            //prepare listview
            initListView();

            Application2.AddMessageFilter(this);
            win32.AllKeys(true);

            this.KeyPreview = true;

            _hwnd = new List <IntPtr>();
            _hwnd.Add(this.Handle);
            _hwnd.Add(listView1.Handle);
        }
示例#4
0
        public void AddMessageFilterTest()
        {
            AutoResetEvent filterEvent = new AutoResetEvent(false);
            TestFilter     filter      = new TestFilter(filterEvent);

            Application2.AddMessageFilter(filter);

            Form f = new Form();

            f.Visible = true;
            Application2.DoEvents();

            Assert.IsTrue(filterEvent.WaitOne(1000, false), "Filter PreFilterMessage was not called");

            filterEvent.Close();
            f.Dispose();
            Application2.Exit();
        }
示例#5
0
 private void mnuIMessageFilter_Click(object sender, EventArgs e)
 {
     mnuIMessageFilter.Checked = !mnuIMessageFilter.Checked;
     if (mnuIMessageFilter.Checked)
     {
         if (!_bMessageFilterActive)
         {
             Application2.AddMessageFilter(this);
             _bMessageFilterActive = true;
         }
     }
     else
     {
         if (_bMessageFilterActive)
         {
             Application2.RemoveMessageFilter(this);
             _bMessageFilterActive = false;
         }
     }
 }
示例#6
0
 public static void Main()
 {
     Application2.AddMessageFilter(mudFilter);
     Application2.Run(new MainForm());
 }