Re: Intercepting the WM_HELP message
From: Maarten Struys, eMVP (maarten.struys_at_nospam.pts.nl)
Date: 03/23/04
- Next message: Ravichandran J.V.: "Re: Test a int if it is dividable by4"
- Previous message: Maarten Struys, eMVP: "Re: Intercepting the WM_HELP message"
- In reply to: Maarten Struys, eMVP: "Re: Intercepting the WM_HELP message"
- Messages sorted by: [ date ] [ thread ]
Date: Tue, 23 Mar 2004 06:13:21 +0100
I decided to quickly test the code, of course I found another error, but
here is a working snippet:
Again, make sure to add the Microsoft.WindowsCE.Forms reference.
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.Windows.Forms
Imports System.Data
Imports OpenNETCF
Imports OpenNETCF.Drawing
Imports OpenNETCF.Windows.Forms
Public Class Form1
Inherits System.Windows.Forms.Form
Private mainMenu1 As System.Windows.Forms.MainMenu
Public Sub New()
InitializeComponent()
ApplicationEx.AddMessageFilter(New MessageFilter)
End Sub
Protected Overloads Sub Dispose(ByVal disposing As Boolean)
MyBase.Dispose(disposing)
End Sub
Private Sub InitializeComponent()
Me.mainMenu1 = New System.Windows.Forms.MainMenu
Me.Menu = Me.mainMenu1
Me.Text = "Form1"
End Sub
Shared Sub Main()
ApplicationEx.Run(New Form1)
End Sub
End Class
Public Class MessageFilter
Implements IMessageFilter
Public Function PreFilterMessage(ByRef m As
Microsoft.WindowsCE.Forms.Message) As Boolean Implements
IMessageFilter.PreFilterMessage
If m.Msg = WinMsg.WM_HELP Then
OpenNETCF.Diagnostics.Process.Start("peghelp.exe", "test.htm")
Return True
End If
Return False
End Function
End Class
--
Maarten Struys, eMVP
PTS Software bv
www.opennetcf.org | www.dotnetfordevices.com
"Maarten Struys, eMVP" <maarten.struys@nospam.pts.nl> wrote in message
news:uVRmZHJEEHA.1272@TK2MSFTNGP11.phx.gbl...
> Hmm, it looks like I forgot to actually add the message filter. No
excuses,
> it is just getting late I guess. Hopefully the code works for you after
> adding the following statement (eg in the form's constructor):
> ApplicationEx.AddMessageFilter (new MessageFilter)
>
> Again I have not tested it and I am not a VB person, but hopefully it
gives
> you a start.
>
> Regards,
>
> --
> Maarten Struys, eMVP
> PTS Software bv
>
> www.opennetcf.org | www.dotnetfordevices.com
>
> "Maarten Struys, eMVP" <maarten.struys@nospam.pts.nl> wrote in message
> news:ucnHw8IEEHA.1600@tk2msftngp13.phx.gbl...
> > If you downloaded and installed the Smart Device Framework you basically
> > have everything you need.
> >
> > The sample should look something like this (I haven't actually tested
the
> > code):
> > -------------------------------------------
> > Imports OpenNETCF
> > Imports OpenNETCF.Drawing
> > Imports OpenNETCF.Windows.Forms
> >
> > Public Class Form1
> > Inherits System.Windows.Forms.Form
> > Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
> >
> > #Region " Windows Form Designer generated code "
> >
> > Public Sub New()
> > MyBase.New()
> >
> > 'This call is required by the Windows Form Designer.
> > InitializeComponent()
> >
> > 'Add any initialization after the InitializeComponent() call
> >
> > End Sub
> >
> > 'Form overrides dispose to clean up the component list.
> > Protected Overloads Overrides Sub Dispose(ByVal disposing As
Boolean)
> > MyBase.Dispose(disposing)
> > End Sub
> >
> > 'NOTE: The following procedure is required by the Windows Form
> Designer
> > 'It can be modified using the Windows Form Designer.
> > 'Do not modify it using the code editor.
> > Private Sub InitializeComponent()
> > Me.MainMenu1 = New System.Windows.Forms.MainMenu()
> > Me.Menu = Me.MainMenu1
> > Me.Text = "Form1"
> >
> > End Sub
> >
> > #End Region
> >
> > End Class
> >
> > Public Class MessageFilter
> > Implements IMessageFilter
> >
> > Public Function PreFilterMessage(ByRef m As
> > Microsoft.WindowsCE.Forms.Message) As Boolean Implements
> > OpenNETCF.Windows.Forms.IMessageFilter.PreFilterMessage
> > If m.Msg = WinMsg.WM_HELP Then
> > OpenNETCF.Diagnostics.Process.Start("peghelp.exe",
"test.htm")
> > End If
> >
> > End Function
> > End Class
> > ----------------------------
> >
> > You have to make sure to add a reference to Microsoft.WindowsCE.Forms
> > because that is where the Message class is defined.
> >
> > We'll take a look at the sample and make sure it can be used as
published.
> >
> > Regards,
> >
> > --
> > Maarten Struys, eMVP
> > PTS Software bv
> >
> > www.opennetcf.org | www.dotnetfordevices.com
> >
> > "Michael Lahrkamp" <mlahrkamp@bitstorm.com> wrote in message
> > news:eAlPcqIEEHA.1272@TK2MSFTNGP11.phx.gbl...
> > > Thanks for the reply. I've tried downloading the sample, but it
appears
> > that
> > > the WinMsg.cs is not included and nowhere to be found on the OpenNetCF
> > site.
> > > This makes this example less useful!
> > >
> > > Any other sources out there?
> > >
> > > Mike
> > >
> > >
> > > "Alex Feinman [MVP]" <public_news@alexfeinman.com> wrote in message
> > > news:Ovf2OZIEEHA.2932@tk2msftngp13.phx.gbl...
> > > >
> > >
> >
>
http://blog.opennetcf.org/pfoot/PermaLink.aspx?guid=00908fbe-6900-41ad-95bd-a2aabd83f41a
> > > >
> > > > --
> > > > Alex Feinman
> > > > ---
> > > > Coming to MDC? make sure to stop by the session CLI345
> > > > on Thursday for OpenNETCF talk
> > > >
> > > >
> > > > "Michael Lahrkamp" <mlahrkamp@bitstorm.com> wrote in message
> > > > news:ugEHUIIEEHA.2908@TK2MSFTNGP09.phx.gbl...
> > > > > Hi All:
> > > > >
> > > > > I'm using VB.NET and want to capture the WM_HELP message in order
to
> > > > trigger
> > > > > the help file for a PPC application. Anybody got any suggestions?
> All
> > > help
> > > > > appreciated! This is becoming a critical item.
> > > > >
> > > > > Thanks,
> > > > > Mike
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> >
> >
>
>
- Next message: Ravichandran J.V.: "Re: Test a int if it is dividable by4"
- Previous message: Maarten Struys, eMVP: "Re: Intercepting the WM_HELP message"
- In reply to: Maarten Struys, eMVP: "Re: Intercepting the WM_HELP message"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|