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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C#
  4. Messages of Child applications

Messages of Child applications

Scheduled Pinned Locked Moved C#
securityhelptutorialquestion
3 Posts 3 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

    Hi EveryBody, I used the later code to handle some messages sent to my application and it works, but my question is how to handle messages sent for child applications of my application(parent) [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] protected override void WndProc(ref Message m) { // Listen for operating system messages. switch (m.Msg) { case WM_SIZING: MessageBox.Show("Sizing"); return ; case WM_SIZE: MessageBox.Show("Size"); if(m.WParam==(IntPtr)SIZE_MINIMIZED) MessageBox.Show("SIZE_MINIMIZED"); else if(m.WParam==(IntPtr)SIZE_MAXIMIZED) MessageBox.Show("SIZE_MAXIMIZED"); return; case SW_MAXIMIZE: MessageBox.Show("SW_MAXIMIZE"); return; case WM_MOVING: MessageBox.Show("Moving"); return; } base.WndProc(ref m); } Please I need a very fast help. Thank you .

    D H 2 Replies Last reply
    0
    • T T i T i

      Hi EveryBody, I used the later code to handle some messages sent to my application and it works, but my question is how to handle messages sent for child applications of my application(parent) [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] protected override void WndProc(ref Message m) { // Listen for operating system messages. switch (m.Msg) { case WM_SIZING: MessageBox.Show("Sizing"); return ; case WM_SIZE: MessageBox.Show("Size"); if(m.WParam==(IntPtr)SIZE_MINIMIZED) MessageBox.Show("SIZE_MINIMIZED"); else if(m.WParam==(IntPtr)SIZE_MAXIMIZED) MessageBox.Show("SIZE_MAXIMIZED"); return; case SW_MAXIMIZE: MessageBox.Show("SW_MAXIMIZE"); return; case WM_MOVING: MessageBox.Show("Moving"); return; } base.WndProc(ref m); } Please I need a very fast help. Thank you .

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #2

      Child applications? There's no such thing. Are you talking about child Windows or MDIChildren? Each form has it's own message pump. Your parent form will not get the messages meant for child forms. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

      1 Reply Last reply
      0
      • T T i T i

        Hi EveryBody, I used the later code to handle some messages sent to my application and it works, but my question is how to handle messages sent for child applications of my application(parent) [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")] protected override void WndProc(ref Message m) { // Listen for operating system messages. switch (m.Msg) { case WM_SIZING: MessageBox.Show("Sizing"); return ; case WM_SIZE: MessageBox.Show("Size"); if(m.WParam==(IntPtr)SIZE_MINIMIZED) MessageBox.Show("SIZE_MINIMIZED"); else if(m.WParam==(IntPtr)SIZE_MAXIMIZED) MessageBox.Show("SIZE_MAXIMIZED"); return; case SW_MAXIMIZE: MessageBox.Show("SW_MAXIMIZE"); return; case WM_MOVING: MessageBox.Show("Moving"); return; } base.WndProc(ref m); } Please I need a very fast help. Thank you .

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

        Dave's right about the message pump. Some controls will send their parents messages, and these are documented in the Platform SDK (almost every control in Windows Forms encapsulates Windows Common Controls). There is another way, though. Implement the IMessageFilter interface and add an instance of your implementation using Application.AddMessageFilter. This installs a message filter for the application's message pump, which will trap messages and allow you to process them (or even remove them) before dispatching them to their destination windows.

        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