Partager via


MessageWindow.WndProc, méthode

Mise à jour : novembre 2007

Traiter les messages Windows.

Espace de noms :  Microsoft.WindowsCE.Forms
Assembly :  Microsoft.WindowsCE.Forms (dans Microsoft.WindowsCE.Forms.dll)

Syntaxe

'Déclaration
Protected Overridable Sub WndProc ( _
    ByRef m As Message _
)
'Utilisation
Dim m As Message

Me.WndProc(m)
protected virtual void WndProc(
    ref Message m
)
protected:
virtual void WndProc(
    Message% m
)
protected function WndProc(
    m : Message
)

Paramètres

Notes

La méthode WndProc correspond à la fonction WindowProc Windows native.

Exemples

vb#c#

L'exemple de code suivant est une substitution de la méthode WndProc dans une classe dérivée de MessageWindow. Il examine les messages Windows entrants. Si un message contient l'identificateur WM_CUSTOMMSG, il appelle la fonction de rappel RespondToMessage qui fournit des informations obtenues des parties WParam et LParam du message. Cet exemple de code fait partie d'un exemple plus complet fourni pour la classe MessageWindow.

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

Autorisations

Plateformes

Windows CE, Windows Mobile pour Smartphone, Windows Mobile pour Pocket PC

Le .NET Framework et le .NET Compact Framework ne prennent pas en charge toutes les versions de chaque plateforme. Pour obtenir la liste des versions prises en charge, consultez Configuration requise du .NET Framework.

Informations de version

.NET Compact Framework

Pris en charge dans : 3.5, 2.0, 1.0

Voir aussi

Référence

MessageWindow, classe

Membres MessageWindow

Microsoft.WindowsCE.Forms, espace de noms