Ram keeps increasing when calling WndProc

123 Views Asked by At

i'm making a small c# form app and i copied a piece of code that let me resize a borderless form from the bottom right of the form:

protected override void WndProc(ref Message m)
        {
            if (m.Msg == 0x84)
            {
                Point pos = new Point(m.LParam.ToInt32());
                pos = this.PointToClient(pos);
                if (pos.Y < cCaption)
                {
                    m.Result = (IntPtr)2;
                    return;
                }

                if (pos.X >= this.ClientSize.Width - cGrip && pos.Y >= this.ClientSize.Height - cGrip)
                {
                    m.Result = (IntPtr)17;
                    return;
                }
            }
            base.WndProc(ref m);
        }

The problem is that i wanna make the program as light as possible but every time i resize the form and therefore call this piece of code, the application increases the ram usage.

I don't really understand how WndProc() works and i thank you a lot if you could explain me why the ram usage increases.

0

There are 0 best solutions below