Z
Zanna
Hi, I'm trying to intercept windows messages of a control, so I saw I have
to use a MessageWindow derived class.
I made this simple example, that I thinked would intercept all messages to
my form and changed Form1.Text into the message code.
Obviously it does nothing
Why?
' You can do a Copy-and-paste on a blank .vb file
'
' Form ---------------------------
Imports Microsoft.WindowsCE.Forms
Imports System.Windows.Forms
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
Private Sub InitializeComponent()
Me.Text = "Form1"
End Sub
Private wm As myMW
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
wm = New myMW(DataGrid1)
End Sub
End Class
' Message Window Class---------------------------
Public Class myMW
Inherits MessageWindow
Private pc As Control
Public Sub New(ByVal c As Control)
pc = c
End Sub
Protected Overrides Sub WndProc(ByRef msg As Message)
pc.Text = msg.Msg.ToString
End Sub
End Class
to use a MessageWindow derived class.
I made this simple example, that I thinked would intercept all messages to
my form and changed Form1.Text into the message code.
Obviously it does nothing
Why?
' You can do a Copy-and-paste on a blank .vb file
'
' Form ---------------------------
Imports Microsoft.WindowsCE.Forms
Imports System.Windows.Forms
Public Class Form1
Inherits System.Windows.Forms.Form
Public Sub New()
MyBase.New()
InitializeComponent()
End Sub
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
Private Sub InitializeComponent()
Me.Text = "Form1"
End Sub
Private wm As myMW
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
wm = New myMW(DataGrid1)
End Sub
End Class
' Message Window Class---------------------------
Public Class myMW
Inherits MessageWindow
Private pc As Control
Public Sub New(ByVal c As Control)
pc = c
End Sub
Protected Overrides Sub WndProc(ByRef msg As Message)
pc.Text = msg.Msg.ToString
End Sub
End Class