?
=?ISO-8859-1?Q?Martin_M=FCller?=
Hi folks!
I have a .NET RichTextBox derived class which has to react differently
to WM_GETTEXT (and some other messages) than it does by default
(mainly converting between \n and \r\n).
I override WndProc, but returning the (altered) text does not work:
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
{
case WM_GETTEXT:
string s = ModifyOriginalText(this.Text);
int charsToCopy = Math.Min(m.WParam.ToInt32(),s.Length);
// return the string
m.LParam = Marshal.StringToHGlobalAuto(s.Substring(0,
charsToCopy));
// result is the number of characters copied
m.Result = new IntPtr(charsToCopy);
return;
}
base.WndProc(ref m);
}
I'm pretty sure there's a way to make this work, but right now I can't
see it.
Anyone can help?
TIA,
Martin Müller
I have a .NET RichTextBox derived class which has to react differently
to WM_GETTEXT (and some other messages) than it does by default
(mainly converting between \n and \r\n).
I override WndProc, but returning the (altered) text does not work:
protected override void WndProc(ref System.Windows.Forms.Message m)
{
switch (m.Msg)
{
case WM_GETTEXT:
string s = ModifyOriginalText(this.Text);
int charsToCopy = Math.Min(m.WParam.ToInt32(),s.Length);
// return the string
m.LParam = Marshal.StringToHGlobalAuto(s.Substring(0,
charsToCopy));
// result is the number of characters copied
m.Result = new IntPtr(charsToCopy);
return;
}
base.WndProc(ref m);
}
I'm pretty sure there's a way to make this work, but right now I can't
see it.
Anyone can help?
TIA,
Martin Müller