Updated: July 2010
Implements a Windows message.
Assembly: System.Windows.Forms (in System.Windows.Forms.dll)
The 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 directly. Instead, use the Create method. For the sake of efficiency, the uses its pool of existing s instead of instantiating a new one, if possible. However, if a 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 . 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.
Windows 7, Windows Vista, Windows XP SP2, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP Starter Edition, Windows Server 2008 R2, Windows Server 2008, Windows Server 2003, Windows Server 2000 SP4, Windows Millennium Edition, Windows 98
The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.