Message Filter
-
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)' -
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)'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.”
-
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)'Read the error message. You created a class that inherits from
Form
andIMessageFilter
, but you never provided an implementation forIMessageFilter.PreFilterMessage(...)
.A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
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)'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, LucLuc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, and improve readability.
-
Read the error message. You created a class that inherits from
Form
andIMessageFilter
, but you never provided an implementation forIMessageFilter.PreFilterMessage(...)
.A guide to posting questions on CodeProject[^]
Dave Kreskowiak