Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Catching a message

Catching a message

Scheduled Pinned Locked Moved C#
helpquestion
4 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    T i T i
    wrote on last edited by
    #1

    How could I be able to catch a message that was sent to an application which I have its handle(Window handle)? thanks for help.

    M 1 Reply Last reply
    0
    • T T i T i

      How could I be able to catch a message that was sent to an application which I have its handle(Window handle)? thanks for help.

      M Offline
      M Offline
      Mike Dimmick
      wrote on last edited by
      #2

      Override WndProc. Stability. What an interesting concept. -- Chris Maunder

      W 1 Reply Last reply
      0
      • M Mike Dimmick

        Override WndProc. Stability. What an interesting concept. -- Chris Maunder

        W Offline
        W Offline
        Wraith2
        wrote on last edited by
        #3

        Or if you want a more dynamic solution look up the IMessageFilter interface. Message filters can be added and removed from windows forms application at runtime.

        H 1 Reply Last reply
        0
        • W Wraith2

          Or if you want a more dynamic solution look up the IMessageFilter interface. Message filters can be added and removed from windows forms application at runtime.

          H Offline
          H Offline
          Heath Stewart
          wrote on last edited by
          #4

          Note that this is better for handling application messages, not specific messages for a control. For the latter, you should override WndProc. Using an application filter (IMessageFilter) can slow down your code drastically if you don't optimize it by keeping in mind that all messages posted to your application will filter through it. Also, IMessageFilter only catches messages posted to your application pump (a la PostMessage) while overriding WndProc catches messages posted or sent (a la PostMessage or SendMessage).

          Microsoft MVP, Visual C# My Articles

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups