Message.Create Method

Creates a new Message structure.

Namespace: Microsoft.WindowsCE.Forms
Assembly: Microsoft.WindowsCE.Forms (in microsoft.windowsce.forms.dll)

public static Message Create (
	IntPtr hwnd,
	int msg,
	IntPtr wparam,
	IntPtr lparam
public static Message Create (
	IntPtr hwnd, 
	int msg, 
	IntPtr wparam, 
	IntPtr lparam
public static function Create (
	hwnd : IntPtr, 
	msg : int, 
	wparam : IntPtr, 
	lparam : IntPtr
) : Message



The window handle that the message is for.


The message ID.


The message WParam field.


The message LParam field.

Return Value

A Message structure that represents the message that was created.

Use the Create method to create a Message structure to wrap a message sent by Windows.

The following code example creates and sends a Windows message with the identifier of WM_CUSTOMMSG. The message is given the handle of a message window, named MsgWin, to which it sends the messages. The message contains values for the WParam and LParam parameters, which in this example are current x and y mouse coordinates as obtained from MouseEventArgs, e, in an OnMouseMove method.

This code example is part of a larger example provided for the MessageWindow component.

 Dim msg As Message = Message.Create(MsgWin.Hwnd, MsgWindow.WM_CUSTOMMSG, New IntPtr(e.X), New IntPtr(e.Y))     MessageWindow.SendMessage(msg) 

 Message msg = Message.Create(MsgWin.Hwnd,     MsgWindow.WM_CUSTOMMSG,     (IntPtr)e.X,     (IntPtr)e.Y);     MessageWindow.SendMessage(ref msg); 

  • Full trust for the immediate caller. This member cannot be used by partially trusted code. For more information, see .

Windows CE, Windows Mobile for Pocket PC, Windows Mobile for Smartphone

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Compact Framework

Supported in: 2.0, 1.0

Community Additions