Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Message Filter

Message Filter

Scheduled Pinned Locked Moved C#
csharplinqgraphicshelp
5 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    electriac
    wrote on last edited by
    #1

    I do not understand why this will not compile. I have used it in other programs but I must be missing something here.

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Windows.Forms;

    namespace mfwmp
    {
    public partial class Form1 : Form, IMessageFilter
    {
    public Form1()
    {
    InitializeComponent();
    Application.AddMessageFilter(this);
    }
    }
    }
    //Error 1 'mfwmp.Form1' does not implement interface member //'System.Windows.Forms.IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message)'

    H D L 3 Replies Last reply
    0
    • E electriac

      I do not understand why this will not compile. I have used it in other programs but I must be missing something here.

      using System;
      using System.Collections.Generic;
      using System.ComponentModel;
      using System.Data;
      using System.Drawing;
      using System.Linq;
      using System.Text;
      using System.Windows.Forms;

      namespace mfwmp
      {
      public partial class Form1 : Form, IMessageFilter
      {
      public Form1()
      {
      InitializeComponent();
      Application.AddMessageFilter(this);
      }
      }
      }
      //Error 1 'mfwmp.Form1' does not implement interface member //'System.Windows.Forms.IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message)'

      H Offline
      H Offline
      Henry Minute
      wrote on last edited by
      #2

      Well the PreFilterMessage() Method has been part of the interface since at least .Net 1.1. It would be a pretty weird interface if it had no methods or properties.

      Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”

      1 Reply Last reply
      0
      • E electriac

        I do not understand why this will not compile. I have used it in other programs but I must be missing something here.

        using System;
        using System.Collections.Generic;
        using System.ComponentModel;
        using System.Data;
        using System.Drawing;
        using System.Linq;
        using System.Text;
        using System.Windows.Forms;

        namespace mfwmp
        {
        public partial class Form1 : Form, IMessageFilter
        {
        public Form1()
        {
        InitializeComponent();
        Application.AddMessageFilter(this);
        }
        }
        }
        //Error 1 'mfwmp.Form1' does not implement interface member //'System.Windows.Forms.IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message)'

        D Offline
        D Offline
        Dave Kreskowiak
        wrote on last edited by
        #3

        Read the error message. You created a class that inherits from Form and IMessageFilter, but you never provided an implementation for IMessageFilter.PreFilterMessage(...).

        A guide to posting questions on CodeProject[^]
        Dave Kreskowiak

        E 1 Reply Last reply
        0
        • D Dave Kreskowiak

          Read the error message. You created a class that inherits from Form and IMessageFilter, but you never provided an implementation for IMessageFilter.PreFilterMessage(...).

          A guide to posting questions on CodeProject[^]
          Dave Kreskowiak

          E Offline
          E Offline
          electriac
          wrote on last edited by
          #4

          Thanks got it fixed with your help. Stupid me. I assumed the minimal code should have compiled.

          1 Reply Last reply
          0
          • E electriac

            I do not understand why this will not compile. I have used it in other programs but I must be missing something here.

            using System;
            using System.Collections.Generic;
            using System.ComponentModel;
            using System.Data;
            using System.Drawing;
            using System.Linq;
            using System.Text;
            using System.Windows.Forms;

            namespace mfwmp
            {
            public partial class Form1 : Form, IMessageFilter
            {
            public Form1()
            {
            InitializeComponent();
            Application.AddMessageFilter(this);
            }
            }
            }
            //Error 1 'mfwmp.Form1' does not implement interface member //'System.Windows.Forms.IMessageFilter.PreFilterMessage(ref System.Windows.Forms.Message)'

            L Offline
            L Offline
            Luc Pattyn
            wrote on last edited by
            #5

            Hi George,

            electriac wrote:

            public partial class Form1 : Form, IMessageFilter

            when you promise to implement some interface, you must do so. Hence: - either drop the IMessageFilter in that line; - or provide all its members; that would be bool PreFilterMessage(ref Message m) { ... } Cheers, Luc

            Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum

            Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups