MessageWindow.WndProc Method

Process Windows-based messages.

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

Syntax

'Declaration
Protected Overridable Sub WndProc ( _
    ByRef m As Message _
)
'Usage
Dim m As Message

Me.WndProc(m)
protected virtual void WndProc (
    ref Message m
)
protected:
virtual void WndProc (
    Message% m
)
protected void WndProc (
    /** @ref */ Message m
)
Not applicable.

Parameters

  • m
    A Windows-based message.

Remarks

The WndProc method corresponds to the native Windows WindowProc function.

Example

The following code example is an override of the WndProc method in a class derived from MessageWindow. It examines incoming Windows-based messages. If a message has the identifier WM_CUSTOMMSG, it calls the RespondToMessage callback function providing information obtained from the WParam and LParam parts of the message. This code example is part of a larger example provided for the MessageWindow class.

' Override the default WndProc behavior to examine messages.
 Protected Overrides Sub WndProc(ByRef msg As Microsoft.WindowsCE.Forms.Message)
  Select Case msg.Msg
  ' If message is of interest, invoke the method on the form that
  ' functions as a callback to perform actions in response to the message.
  Case WM_CUSTOMMSG
   Me.msgform.RespondToMessage(Fix(msg.WParam.ToInt32), Fix(msg.LParam.ToInt32))
  End Select

 ' Call the base class WndProc method
 ' to process any messages not handled.
 MyBase.WndProc(msg)
 End Sub
 // Override the default WndProc behavior to examine messages.
 protected override void WndProc(ref Message msg)
 {
  switch(msg.Msg)
  {
   // If message is of interest, invoke the method on the form that
   // functions as a callback to perform actions in response to the message.
   case WM_CUSTOMMSG:
    this.msgform.RespondToMessage((int)msg.WParam, (int)msg.LParam);
    break;
  }
  // Call the base WndProc method
  // to process any messages not handled.
  base.WndProc(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

MessageWindow Class
MessageWindow Members
Microsoft.WindowsCE.Forms Namespace