Window Proc

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Just close your eyes and see

    Window Proc

    Kindly i want to know how to use window proc from within C# Application
    is there any tutorial or somebody can help me in doing this
  • Nassos

    #2
    Re: Window Proc

    Hi man,
    in each form:
    protected override void WndProc(ref Message m)

    {

    //Exit Message Code

    int WM_QUERYENDSESS ION = 0x11;

    //Cancel Message Code

    int WM_CANCELMODE = 0x1F;

    // if the message is to shut down/reset window

    if (m.Msg == WM_QUERYENDSESS ION)

    {

    base.WndProc(re f m);

    //You can also cancel the exit window message by using

    //the following lines

    //Message MyMessage = new Message();

    //MyMessage.Msg = Convert.ToInt32 (WM_CANCELMODE) ;

    //base.WndProc(re f MyMessage);

    }

    else

    {

    //carry on with the message

    base.WndProc(re f m);

    }

    }

    hope that helps.



    "Just close your eyes and see"
    <Justcloseyoure yesandsee@discu ssions.microsof t.com> wrote in message
    news:0287E899-3B59-480C-80AD-492F52EE09E7@mi crosoft.com...[color=blue]
    > Kindly i want to know how to use window proc from within C# Application
    > is there any tutorial or somebody can help me in doing this[/color]


    Comment

    • Ignacio Machin \( .NET/ C# MVP \)

      #3
      Re: Window Proc

      Hi,

      Use it only if you know what you are doing, otherwise use the event handling
      provided by the framework.

      All you have to do is overwrite WndProc ,Take a look at Control.WndProc in
      MSDN


      Cheers,
      --
      Ignacio Machin,
      ignacio.machin AT dot.state.fl.us
      Florida Department Of Transportation

      "Just close your eyes and see"
      <Justcloseyoure yesandsee@discu ssions.microsof t.com> wrote in message
      news:0287E899-3B59-480C-80AD-492F52EE09E7@mi crosoft.com...[color=blue]
      > Kindly i want to know how to use window proc from within C# Application
      > is there any tutorial or somebody can help me in doing this[/color]


      Comment

      Working...