Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All

Message Structure

Implements a Windows message.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

[<Sealed>]
[<SecurityPermissionAttribute(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.UnmanagedCode)>]
type Message =  struct end

The Message type exposes the following members.

  NameDescription
Public propertyHWndGets or sets the window handle of the message.
Public propertyLParamSpecifies the LParam field of the message.
Public propertyMsgGets or sets the ID number for the message.
Public propertyResultSpecifies the value that is returned to Windows in response to handling the message.
Public propertyWParamGets or sets the WParam field of the message.
Top

  NameDescription
Public methodStatic memberCreateCreates a new Message.
Public methodEqualsDetermines whether the specified object is equal to the current object. (Overrides ValueType.Equals(Object).)
Public methodGetHashCodeReturns the hash code for this instance. (Overrides ValueType.GetHashCode().)
Public methodGetLParamGets the LParam value and converts the value to an object.
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Public methodToStringInfrastructure. Returns a String that represents the current Message. (Overrides ValueType.ToString().)
Top

  NameDescription
Public operatorStatic memberEqualityDetermines whether two instances of Message are equal.
Public operatorStatic memberInequalityDetermines whether two instances of Message are not equal.
Top

The Message structure wraps messages that Windows sends. You can use this structure to wrap a message and assign it to the window procedure to be dispatched. You can also use this structure to get information about a message the system sends to your application or controls. For more information about Windows messages, see Messages and Message Queues.

You cannot create the Message directly. Instead, use the Create method. For the sake of efficiency, the Message uses its pool of existing Messages instead of instantiating a new one, if possible. However, if a Message is not available in the pool, a new one is instantiated.

The following code example demonstrates overriding the WndProc method to handle operating system messages identified in the Message. The WM_ACTIVATEAPP operating system message is handled in this example to know when another application is becoming active. For information about the available Message.Msg, Message.LParam, and Message.WParam values, see the MSG Structure documentation. For information about the actual constant values, see Message Constants.

No code example is currently available or this language may not be supported.

.NET Framework

Supported in: 4.6, 4.5, 4, 3.5, 3.0, 2.0, 1.1

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2015 Microsoft