共用方式為


Message.Create 方法

建立新的 Message 結構。

命名空間:  Microsoft.WindowsCE.Forms
組件:  Microsoft.WindowsCE.Forms (在 Microsoft.WindowsCE.Forms.dll 中)

語法

'宣告
Public Shared Function Create ( _
    hwnd As IntPtr, _
    msg As Integer, _
    wparam As IntPtr, _
    lparam As IntPtr _
) As Message
'用途
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 function Create(
    hwnd : IntPtr, 
    msg : int, 
    wparam : IntPtr, 
    lparam : IntPtr
) : Message

參數

傳回值

型別:Microsoft.WindowsCE.Forms.Message

Message 結構,表示已建立的訊息。

備註

使用 Create 方法建立 Message 物件,以便將 Windows 傳送的訊息換行。

範例

下列程式碼範例會建立及傳送一則 Windows 訊息,且訊息中包含 WM_CUSTOMMSG 的識別項。系統會為這則訊息提供訊息視窗的控制代碼 (此控制代碼稱為 MsgWin),且會將訊息傳送到此訊息視窗。此訊息包含 WParam 和 LParam 參數的值,而在此範例中,這些值即為目前的 x 和 y 滑鼠座標 (由 OnMouseMove 方法中的 MouseEventArgs、e 取得)。

這個程式碼範例是 MessageWindow 元件完整範例的一部分。

[Visual Basic]

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

[C#]

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

使用權限

平台

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

.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求

版本資訊

.NET Compact Framework

支援版本:3.5、2.0、1.0

請參閱

參考

Message 結構

Message 成員

Microsoft.WindowsCE.Forms 命名空間