views:

274

answers:

5

Should be an easy question, so don't all pile on -

I'm trying to override WndProc like this:

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

snip...

public class GTextBox : TextBox
{
    protected override void WndProc(ref Message m)

and I get this error:

error CS0246: The type or namespace name 'Message' could not be found (are you missing a using directive or an assembly reference?)

I've poked around a little but I don't see how to find out where Message is defined? Any hints?

Update: "using System.Windows.Forms" is in the file, and I have checked the DLL reference. Hmm... probably time to re-boot for good luck?

Update 2: My Bad! - I am using the Compact Framework, and it does not allow direct access to the Message structure. Ouch - should have put that in my original question

Update 3: Excellent article on CF and WndProc handling http://msdn.microsoft.com/en-us/magazine/cc188736.aspx

+1  A: 

The Message struct is in the System.Windows.Forms namespace and assembly.

http://msdn.microsoft.com/en-us/library/system.windows.forms.message.aspx

Adam Robinson
thanks - but note the "using System.Windows.Forms" in the snippet, that's all I need right? I've also checked the reference to the dll. hmmmm.....
I'd recommend checking the references once more; maybe deleting them readding it/them? Also try cleaning your solution from the Build menu.
Adam Robinson
A: 

I believe it's "System.Windows.Forms.Message." I'm not sure why you're getting that error, it looks like you're "using System.Windows.Forms;".

Maybe the DLL reference got deleted?

Andy White
A: 

Took a bit of a creative google search but:

http://msdn.microsoft.com/en-us/library/system.windows.forms.message.aspx

Matt Campbell
A: 

Thanks for all the help - I just realized the problem is I am using the Compact Framework, targeting Windows Mobile, and there is no direct access to Message.

A: 

It's publicly available in the Microsoft.WindowsCE.Forms namespace. You need to add a reference to the assembly.

ctacke