zoukankan      html  css  js  c++  java
  • IDocHostShowUI

    public class MyWebBrowser : WebBrowser
        {
            #region ExtendedWebBrowserSite
            class ExtendedWebBrowserSite : WebBrowser.WebBrowserSite, UnsafeNativeMethods.IDocHostShowUI
            {
                public ExtendedWebBrowserSite(WebBrowser host)
                    : base(host)
                {
                }

                void UnsafeNativeMethods.IDocHostShowUI.ShowMessage(ref UnsafeNativeMethods._RemotableHandle hwnd, string lpstrText, string lpstrCaption, uint dwType, string lpstrHelpFile, uint dwHelpContext, out int plResult)
                {
                    plResult = 1;
                   
                 //  MessageBox.Show(lpstrText, lpstrCaption);
                    
                }

                void UnsafeNativeMethods.IDocHostShowUI.ShowHelp(ref UnsafeNativeMethods._RemotableHandle hwnd, string pszHelpFile, uint uCommand, uint dwData, UnsafeNativeMethods.tagPOINT ptMouse, object pDispatchObjectHit)
                {

                }
            }

            protected override WebBrowserSiteBase CreateWebBrowserSiteBase()
            {
                return new ExtendedWebBrowserSite(this);
            }
            #endregion
        }

        public class UnsafeNativeMethods
        {
            #region IDocHostShowUI
            [StructLayout(LayoutKind.Explicit, Pack = 4)]
            public struct __MIDL_IWinTypes_0009
            {
                // Fields
                [FieldOffset(0)]
                public int hInproc;
                [FieldOffset(0)]
                public int hRemote;
            }

            [StructLayout(LayoutKind.Sequential, Pack = 4)]
            public struct _RemotableHandle
            {
                public int fContext;
                public __MIDL_IWinTypes_0009 u;
            }

            [StructLayout(LayoutKind.Sequential, Pack = 4)]
            public struct tagPOINT
            {
                public int x;
                public int y;
            }

            [ComImport, Guid("C4D244B0-D43E-11CF-893B-00AA00BDCE1A"), InterfaceType((short)1)]
            public interface IDocHostShowUI
            {
                [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
                void ShowMessage([In, ComAliasName("ExtendedWebBrowser2.UnsafeNativeMethods.wireHWND")] ref _RemotableHandle hwnd, [In, MarshalAs(UnmanagedType.LPWStr)] string lpstrText, [In, MarshalAs(UnmanagedType.LPWStr)] string lpstrCaption, [In] uint dwType, [In, MarshalAs(UnmanagedType.LPWStr)] string lpstrHelpFile, [In] uint dwHelpContext, [ComAliasName("ExtendedWebBrowser2.UnsafeNativeMethods.LONG_PTR")] out int plResult);
                [MethodImpl(MethodImplOptions.InternalCall, MethodCodeType = MethodCodeType.Runtime)]
                void ShowHelp([In, ComAliasName("ExtendedWebBrowser2.UnsafeNativeMethods.wireHWND")] ref _RemotableHandle hwnd, [In, MarshalAs(UnmanagedType.LPWStr)] string pszHelpFile, [In] uint uCommand, [In] uint dwData, [In] tagPOINT ptMouse, [Out, MarshalAs(UnmanagedType.IDispatch)] object pDispatchObjectHit);
            }
            #endregion

        }

  • 相关阅读:
    WPS 模拟手写签名
    Flask 正则匹配路由、异常
    FLASK 加载配置、简单传参调用、指定请求方式、返回json、网页跳转(也可以自己的视图函数)、自定义状态码
    python IDLE 自动提示功能
    PYQT设计无边框窗体
    PYQT窗口居中
    PYQT窗口托盘目录
    PYQT窗口风格
    PYQT窗口可视化编程
    PYQT控件使用
  • 原文地址:https://www.cnblogs.com/zymsdn/p/2182712.html
Copyright © 2011-2022 走看看