overriding WndProc

F

fh1996

Protected override void WndProc(ref Message m)
{
....
base.WndProc(ref m);
}

When should override the WndProc member of base class?

Can "Parent.WndProc(...)" be used to replace "base.WndProc(...)" in the
following code?

What's the meaning of "parent" in C#?

Why is it needed to call "base.WndProc(ref m);" at the end of the WndProc()?

Thanks!
 
W

Wiktor Zychla

Protected override void WndProc(ref Message m)
{
...
base.WndProc(ref m);
}

When should override the WndProc member of base class?

if this is you who define the base class, you can override also the WndProc
of base class. in any other case it could be difficult. note that in the
above code you do not override the WndProc of the base class but you just
call it.
Can "Parent.WndProc(...)" be used to replace "base.WndProc(...)" in the
following code?

it can be used but it could have no sense at all.
What's the meaning of "parent" in C#?

Parent form of a form F is a Parent window of it (typically: a window that
created F).
Why is it needed to call "base.WndProc(ref m);" at the end of the
WndProc()?

to preserve the functionality of the newly created class. if you do not call
the WndProc from a base class, the newly created class will have only the
functionality that is defined inside it.
 
R

Reza

As i understand it you need to pass the messages you do not handle to your
base class.
Although in the help it says base.WndProc(m) it don't work as i tested this
myself :)
Instead you must use xxx::WndProc(m). Where xxx stands for you class name.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top