title: How can I convert an unmanaged IntPtr type to a c# string?
body: <p>I'm new to C# (from a native C++ background) and I'm trying to write a little UI to print windows broadcast messages among other things.  I've overridden the default WndProc message loop in my C# program like so:</p>
  
  <pre><code>[System.Security.Permissions.PermissionSet(System.Security.Permissions.SecurityAction.Demand, Name = "FullTrust")]
      protected override void WndProc(ref Message m)
      {
          // Listen for operating system broadcasts.
          switch (m.Msg)
          {
              case WM_SETTINGCHANGE:
  
                  this.richTextLog.Text += "WM_SETTINGCHANGE - lParam=" + m.LParam.ToString() + "\n";
  
                  break;
          }
          base.WndProc(ref m);
      }
  </code></pre>
  
  <p>What I'd like to know, is how to obtain a string representation of the lParam object which is of type IntPtr.  It's essentially a void* in C++ land, can I cast it inside C# somehow?  Presumably doing so is inherently unsafe.</p>