This value type wraps a Win32 message, and is used in message
filtering (through the Application.AddMessageFilter() method) and Control.WndProc() message
processing. Obviously, this is very closely bound to the operating
system, and you should only use this sort of message processing in
interop applications—typically, when you are wrapping a Win32
control for your own purposes. You can retrieve the
HWnd, LParam,
WParam, and Msg ID. You can
also set the Result to be returned to Windows if
you handle the message.
You shouldn't create instances of this class
directly, but instead use the static Create()
factory method, which ensures that the message is properly
initialized.
public struct Message {
// Public Instance Properties
public IntPtr HWnd{set; get; }
public IntPtr LParam{set; get; }
public int Msg{set; get; }
public IntPtr Result{set; get; }
public IntPtr WParam{set; get; }
// Public Static Methods
public static Message Create(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam);
// Public Instance Methods
public override bool Equals(object o); // overrides ValueType
public override int GetHashCode(); // overrides ValueType
public object GetLParam(Type cls);
public override string ToString(); // overrides ValueType
}