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. Filter messages

Filter messages

Scheduled Pinned Locked Moved C#
help
3 Posts 2 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.
  • A Offline
    A Offline
    A T I F
    wrote on last edited by
    #1

    Hi! I have created a similar thread before and I was not able to find a possible solution. Here is the issue again. I need someplace where I can filter all messages of the application (main form and all child forms). I have implemented message filters but somehow the child modal dialogs does not seem to have message filtered (there messages do not come into the filter).

    A 1 Reply Last reply
    0
    • A A T I F

      Hi! I have created a similar thread before and I was not able to find a possible solution. Here is the issue again. I need someplace where I can filter all messages of the application (main form and all child forms). I have implemented message filters but somehow the child modal dialogs does not seem to have message filtered (there messages do not come into the filter).

      A Offline
      A Offline
      Alex Korchemniy
      wrote on last edited by
      #2

      MSDN link[^] I'm sure someone has mentioned Application.AddMessageFilter Method. Its exactly what you need. The following example traps all left-button mouse activity:

      #region IMessageFilter Members
      public bool PreFilterMessage(ref Message m)
      {
      if (m.Msg >= 513 && m.Msg <= 515)
      {
      System.Diagnostics.Trace.WriteLine("Caught");
      return true;
      }
      return false;
      }
      #endregion

      If you have any problems post back. This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy

      A 1 Reply Last reply
      0
      • A Alex Korchemniy

        MSDN link[^] I'm sure someone has mentioned Application.AddMessageFilter Method. Its exactly what you need. The following example traps all left-button mouse activity:

        #region IMessageFilter Members
        public bool PreFilterMessage(ref Message m)
        {
        if (m.Msg >= 513 && m.Msg <= 515)
        {
        System.Diagnostics.Trace.WriteLine("Caught");
        return true;
        }
        return false;
        }
        #endregion

        If you have any problems post back. This posting is provided "AS IS" with no warranties, and confers no rights. Alex Korchemniy

        A Offline
        A Offline
        A T I F
        wrote on last edited by
        #3

        I tired that but this message filter does not seem to work on child dialogs (froms).

        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