title: NativeWindow WndProc not receiving messages
body: <p>Could someone shed some light on why my <code>WndProc</code> method as implemented below isn't receiving any messages? If I put this class below in a WinForms application and pass in <em>that</em> application's handle, <code>WndProc</code> receives messages as I would expect. However, using the IntPtr returned from <code>GetForegroundWindow()</code> as I have below doesn't yield the same results. (FWIW, I have my code set up to execute <code>GetForegroundWindow()</code> when my application is hidden, so I'm certain that the IntPtr is referring to an outside application.) My goal here is to monitor certain events from outside applications.</p>
  
  <pre><code>public class MyNativeWindow : NativeWindow
  {
      [DllImport("user32.dll", ExactSpelling = true, SetLastError = true)]
      private static extern IntPtr GetForegroundWindow();
  
      public MyNativeWindow()
      {
          this.AssignHandle(GetForegroundWindow());
      }
  
      // Never called... I set a breakpoint
      [System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
      protected override void WndProc(ref Message m)
      {
          base.WndProc(ref m);
      }
  }
  </code></pre>