I wanted to forward the Here's what I did: This does not work However, instead of MouseWheel events produced at the Farm level so that they can be processed An embedded
WebBrowser control, even when that control does not focus on.
IMessageFilter.PreFilterMessage .
Application.AddMessageFilter it.
WM_MOUSEWHEEL.
WebBrowser ) using
SendMessage . In the code, it looks like this:
bool IMessageFilter.PreFilterMessage {if (m.msg == 0x20A) / / WM_MOUSEWHEEL {if (this.target! = Tap) {var handle = this.target.Handle; Native Message message (handle, M. message, M.P.Param, M.L.Param); Back true; } } return false; } // Registering the message filter: System.Windows.Forms.Application.AddMessageFilter (this); // Win32 code: protected static class NativeMethods {[System.Runtime.InteropServices.DllImport ( "user32.dll")] public static exile System.IntPtr SendMessage (System.IntPtr hWnd, System.Int32 message, System.IntPtr wParam, system ITPTR LPRAM); }
WebBrowser I see the
panel as the target form I specify, so it works very well.
Import system time. Interporse public class form 1 promotions iMessage filter public sub new () 'This call is required by the designer. InitializeComponent () Add any start after the 'InitializeComponent () call. System.Windows.Forms.Application.AddMessageFilter (Me) End Sub Private Sub Form1_Load (as the object, such as e EventArgs) Handles Me.Load Me.WebBrowser1.Navigate ( 'D: \ D \ test3.html " ) End Sub Private function IMessageFilter_PreFilterMessage Boolean Implements as IMessageFilter.PreFilterMessage then (M Send as ByRef) m.Msg = & amp; H20A again 'WM_MOUSEWHEEL so m.HWnd & lt; & gt; 0 then dim handle = m .HWnd handle = NativeMethods.FindWindowEx (handle, IntPtrkZero, "Shell embedding", nothing) handle = NativeMethods.FindWindowEx (handle, IntPtrkZero, "Shell DocObject see" nothing) = NativeMethods handle ( Ndroad Explorer surgery), some not) resident Vidhianksenmsej (handles, M.am.ask, Mkpikparam, M.alkpamm) and returns and returns and returns and Folrs and function protected Infeyrtebl Class Native Methls private All new () end subsystems. Runtime. Interp Services. Dell Import ("user32.dll") _ Public Shared Function SendMessage (hWnd System.IntPtr, as Message System.Int32, wParam System. As IntPtr, as in the form of lParam System.IntPtr) Sys As the tem.IntPtr termination function, System.Runtime.InteropServices.DllImport ("user32.dll") & gt; _ Public Shared Function FindWindowEx (system as hwndParent, hwndChildAfter as System.IntPtr, string as Classname, as windowName string) System.IntPtr End Function End Class End Class < / Div>
No comments:
Post a Comment