hubFS: THE place for F#

. . . are you on The Hub?
Welcome to hubFS: THE place for F# Sign in | Join | Help
in Search

Overriding WndProc (byref problem?)

Last post 06-27-2008, 1:38 by daniel.furrer. 2 replies.
Sort Posts: Previous Next
  •  06-18-2008, 4:29 6165

    Overriding WndProc (byref problem?)

    I'm trying to redefine WndProc on a Windows.Forms control because I want to disable painting updates under certain conditions but I run into a problem:

    As soon as I insert this code into my app..

      override this.WndProc (m : System.Windows.Forms.Message byref) =
        let m2 = m in
        base.WndProc (ref m2)


    .. it crashes at startup (when loading that form).

    {"Error creating window handle."}    System.Exception {System.ComponentModel.Win32Exception}

    It doesn't even matter what I am write as code. Same crash for

      override this.WndProc (m : System.Windows.Forms.Message byref) =
        ()

    Does anybody know what I'm doing wrong? Have you succeed at overriding WndProc?
  •  06-18-2008, 5:05 6167 in reply to 6165

    Re: Overriding WndProc (byref problem?)

    Hi,

    You can try this way:

        override this.WndProc (m : System.Windows.Forms.Message byref) =
            let m2 = &m in
            base.WndProc (&m2)

  •  06-27-2008, 1:38 6213 in reply to 6167

    Re: Overriding WndProc (byref problem?)

    That worked. Thanks.

    (found some more explanation here http://research.microsoft.com/fsharp/manual/lexyacc.aspx#ByRefs)
View as RSS news feed in XML
Powered by Community Server, by Telligent Systems