Share via


Message.Create Method

Creates a new Message structure.

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

Syntax

'Declaration
Public Shared Function Create ( _
    hwnd As IntPtr, _
    msg As Integer, _
    wparam As IntPtr, _
    lparam As IntPtr _
) As Message
'Usage
Dim hwnd As IntPtr
Dim msg As Integer
Dim wparam As IntPtr
Dim lparam As IntPtr
Dim returnValue As Message

returnValue = Message.Create(hwnd, msg, wparam, lparam)
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 Message Create (
    IntPtr hwnd, 
    int msg, 
    IntPtr wparam, 
    IntPtr lparam
)
public static function Create (
    hwnd : IntPtr, 
    msg : int, 
    wparam : IntPtr, 
    lparam : IntPtr
) : Message
Not applicable.

Parameters

  • hwnd
    The window handle that the message is for.
  • msg
    The message ID.
  • wparam
    The message WParam field.
  • lparam
    The message LParam field.

Return Value

A Message structure that represents the message that was created.

Remarks

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

Example

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); 

Platforms

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

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

Version Information

.NET Compact Framework

Supported in: 2.0, 1.0

See Also

Reference

Message Structure
Message Members
Microsoft.WindowsCE.Forms Namespace