Application.AddmessageFilter

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

    Application.AddmessageFilter

    Hi
    I want to reroute messages with a certain code to a specific control.

    I need to intercept those messages at Application level since the main
    window doesn't catch a third party ActiveX. It is done correctly with my
    IMessageFilter.

    From there I would like to create (and SendMessage) a new message with same
    parameters except the Handler. The problem I have is to get the main window
    handler from inside IMessageFilter process.

    Any short example would be very appreciated!

    Philippe (C# student)


  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: Application.Add messageFilter

    Philippe,

    You should be able to change the HWnd property of the structure to the
    handle of the window you want to route the messages to. Since the
    PreFilterMessag e method takes the structure by ref, any changes you make to
    it will stick after the method exits.


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

    "P. Meyer" <philippe.meyer 2@wanadoo.frwro te in message
    news:46506768$0 $27408$ba4acef3 @news.orange.fr ...
    Hi
    I want to reroute messages with a certain code to a specific control.
    >
    I need to intercept those messages at Application level since the main
    window doesn't catch a third party ActiveX. It is done correctly with my
    IMessageFilter.
    >
    From there I would like to create (and SendMessage) a new message with
    same parameters except the Handler. The problem I have is to get the main
    window handler from inside IMessageFilter process.
    >
    Any short example would be very appreciated!
    >
    Philippe (C# student)
    >

    Comment

    • P. Meyer

      #3
      Re: Application.Add messageFilter

      Thanks Nicholas.
      Did not try yet but it's helpful.
      Philippe


      "Nicholas Paldino [.NET/C# MVP]" <mvp@spam.guard .caspershouse.c oma écrit
      dans le message de news:
      5F566EA4-B70F-4A61-BB26-4A3D9A77948A@mi crosoft.com...
      Philippe,
      >
      You should be able to change the HWnd property of the structure to the
      handle of the window you want to route the messages to. Since the
      PreFilterMessag e method takes the structure by ref, any changes you make
      to it will stick after the method exits.
      >
      >
      --
      - Nicholas Paldino [.NET/C# MVP]
      - mvp@spam.guard. caspershouse.co m
      >
      "P. Meyer" <philippe.meyer 2@wanadoo.frwro te in message
      news:46506768$0 $27408$ba4acef3 @news.orange.fr ...
      >Hi
      >I want to reroute messages with a certain code to a specific control.
      >>
      >I need to intercept those messages at Application level since the main
      >window doesn't catch a third party ActiveX. It is done correctly with
      >my IMessageFilter.
      >>
      >From there I would like to create (and SendMessage) a new message with
      >same parameters except the Handler. The problem I have is to get the main
      >window handler from inside IMessageFilter process.
      >>
      >Any short example would be very appreciated!
      >>
      >Philippe (C# student)
      >>
      >

      Comment

      Working...