Windows Messages....

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • GTi

    Windows Messages....

    I need to get access to the Windows Messages queue (WM_xxx)
    I have a old C application that sends some messages to all windows
    on the computer. How can my new C# application receive this message?



  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Windows Messages....

    GTi,

    In your main form, you can override the WndProc method and it will be
    called whenever it receives a message from the loop. However, you have to
    make sure you call the base implementation to WndProc so that other messages
    get processed as well.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "GTi" <blabla@blabla. com> wrote in message
    news:OgIC8J5ZFH A.3144@TK2MSFTN GP12.phx.gbl...[color=blue]
    >I need to get access to the Windows Messages queue (WM_xxx)
    > I have a old C application that sends some messages to all windows
    > on the computer. How can my new C# application receive this message?
    >
    >
    >[/color]


    Comment

    • Chad Myers

      #3
      Re: Windows Messages....

      From which "window" (aka Form, Control, etc in .NET WinForms)?

      If it's just the form in general, in your WhateverForm.cs class, override
      the WndProc or DefWndProc method as appropriate.

      There's also an "OnNotifyMessag e" method that you should use, instead, if
      you're dealing with notify messages.

      If it's a control (like a button or listbox or something), then you'll have
      to create your own class that derrives from that class (Button, ListBox,
      etc) and override the WndProc method as necessary.

      -c


      "GTi" <blabla@blabla. com> wrote in message
      news:OgIC8J5ZFH A.3144@TK2MSFTN GP12.phx.gbl...[color=blue]
      >I need to get access to the Windows Messages queue (WM_xxx)
      > I have a old C application that sends some messages to all windows
      > on the computer. How can my new C# application receive this message?
      >
      >
      >[/color]


      Comment

      • GTi

        #4
        Re: Windows Messages....

        Thanks all...
        But I wonder what is most cost effective:
        (if it matter)
        Using: WndProc or OnNotifyMessage


        Comment

        • cody

          #5
          Re: Windows Messages....

          There shouldn't be any noticeable differences.

          "GTi" <gti@gti.com> schrieb im Newsbeitrag news:42a002a6@n ews.wineasy.se. ..[color=blue]
          > Thanks all...
          > But I wonder what is most cost effective:
          > (if it matter)
          > Using: WndProc or OnNotifyMessage
          >
          >[/color]


          Comment

          • GTi

            #6
            Re: Windows Messages....

            k

            "cody" <deutronium@gmx .de> wrote in message
            news:OQa3%232Aa FHA.3132@TK2MSF TNGP09.phx.gbl. ..[color=blue]
            > There shouldn't be any noticeable differences.
            >
            > "GTi" <gti@gti.com> schrieb im Newsbeitrag
            > news:42a002a6@n ews.wineasy.se. ..[color=green]
            >> Thanks all...
            >> But I wonder what is most cost effective:
            >> (if it matter)
            >> Using: WndProc or OnNotifyMessage
            >>
            >>[/color]
            >
            >[/color]


            Comment

            Working...