×

ai教程网 s 视频教程网

有什么好的AI(illustrator)的视频教程网来分享分享啊?如何截获WebBrowser控件onbeforeunload事件

admin admin 发表于2022-05-10 13:25:02 浏览118 评论0

抢沙发发表评论

有什么好的AI(illustrator)的视频教程网来分享分享啊

百度搜索下“大番薯”试试?忘记是第一个还是第二个了。前段时间看的关于Illustrator的视频教程,CS3的好像,不过讲的真挺好!视频教程可以让你很快速地了解软件的各种功能,然后有本较为系统的书最好吧,因为有时候你遇到问题不可能翻出视频来找解决方法,即便翻出来了,要找到是在第几分钟讲到的也不容易,有本书翻翻就很方便了。网上也有不错的论坛可以去看看,很长见识的。

如何截获WebBrowser控件onbeforeunload事件

  截获WebBrowser控件onbeforeunload事件:  c# winforms 浏览器web-browser onbeforeunload  我在我所主持的WebBrowser控件内部网页中的WinForms应用程序。 该网页的内容如下:   《!DOCTYPE html》  《html lang=“en“ dir=“ltr“》  《head》   《title》onbeforeunload test《/title》   《meta charset=“utf-8“》  《/head》  《body》  《a href=“#“ onclick=“window.location.reload();“》Test《/a》  《script type=“text/javascript“》   window.onbeforeunload = function () {   return ’Are you sure you want to leave this page?’;   };  《/script》  《/body》  《/html》  正如你可以看到我已经subscription了onbeforeunload事件,让导航离开此页面前显示确认对话框。这工作得很好,当我点击重新加载页面的锚。在确认对话框显示并可以取消页面的重载。这工作得很好承载控制的WinForms里面。 现在,我有困难的拦截和关闭时的WinForms应用程序(通过点击例如X键)执行此事件。 我能够获取在WinForms应用程序这个函数的内容,但不管是什么我想我是不是能够得到字符串的内容,这个函数返回,使我后来伪造一个MessageBox时试图关闭应用程序:   webBrowser1.Navigated += (sender, e) =》  {   webBrowser1.Document.Window.Load += (s, ee) =》   {   // In order to get the IHTMLWindow2 interface I have referenced   // the Microsoft HTML Object Library (MSHTML) COM control   var window = (IHTMLWindow2)webBrowser1.Document.Window.DomWindow;   // the bu variable contains the script of the onbeforeunload event   var bu = window.onbeforeunload();   // How to get the string that is returned by this function   // so that I can subscribe to the Close event of the WinForms application   // and show a fake MessageBox with the same text?   };  };  webBrowser1.Navigate(“ CodeGo.net   我已经试过了window.execScript方法没有可用的:   // returns null  var script = string.Format(“({0})();“, bu);  var result = window.execScript(script, “javascript“);  我也曾尝试以下 CodeGo.net,但它也返回null:   var result = window.execScript(“(function() { return ’foo’; })();“, “javascript“);  作为最后一招我第三方的JavaScript解析器来,我可以养活这个函数的主体,它会执行它,并返回值,但是这真的是最后的手段。我会很高兴,如果有一个更自然的方式做微软的MSHTML库。更新: 这是现在解决得益于出色的答案@汉斯提供。对于原因,我不能让他在我的测试机(Win7的X64,NET 4.0客户端端配置文件,IE9,EN-US区域设置)解决方案的工作,我总是得到hr = -2147024809后IDispatch.Invoke打电话。所以,我已经修改了IDispatch的P / Invoke签名以下(此签名并不需要引用c:\windows\system32\stdole2.tlb要添加到项目中):   using System;  using System.Runtime.InteropServices;  using System.Runtime.InteropServices.ComTypes;  [ComImport]  [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]  [Guid(“00020400-0000-0000-C000-000000000046“)]  public interface IDispatch  {   [PreserveSig]   int GetTypeInfoCount(out int Count);   [PreserveSig]   int GetTypeInfo(   [MarshalAs(UnmanagedType.U4)] int iTInfo,   [MarshalAs(UnmanagedType.U4)] int lcid,    out ITypeInfo typeInfo   );   [PreserveSig]   int GetIDsOfNames(   ref Guid riid,   [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.LPWStr)] string rgsNames,    int cNames,    int lcid,    [MarshalAs(UnmanagedType.LPArray)] int rgDispId   );   [PreserveSig]   int Invoke(   int dispIdMember,    ref Guid riid,    uint lcid,    ushort wFlags,   ref System.Runtime.InteropServices.ComTypes.DISPPARAMS pDispParams,    out object pVarResult,   ref System.Runtime.InteropServices.ComTypes.EXCEPINFO pExcepInfo,    IntPtr pArgErr   );  }  然后我已经subscription了Form的Closing事件,并能够获取由返回onbeforeunload事件提示   protected override void OnFormClosing(FormClosingEventArgs e)  {   var window = (IHTMLWindow2)webBrowser1.Document.Window.DomWindow;   var args = new System.Runtime.InteropServices.ComTypes.DISPPARAMS();   var result = new object();   var except = new System.Runtime.InteropServices.ComTypes.EXCEPINFO();   var idisp = window.onbeforeunload as IDispatch;   if (idisp != null)   {   var iid = Guid.Empty;   var lcid = (uint)CultureInfo.CurrentCulture.LCID;   int hr = idisp.Invoke(0, ref iid, lcid, 1, ref args, out result, ref except, null);   if (hr == 0)   {   var msgBox = MessageBox.Show(   this,   (string)result,   “Confirm“,   MessageBoxButtons.OKCancel   );   e.Cancel = msgBox == DialogResult.Cancel;   }   }   base.OnFormClosing(e);  }  本文地址 :CodeGo.net/404722/  -------------------------------------------------------------------------------------------------------------------------   1. 本身不显示对话框。返回一个字符串在箱子的主机必须的。由于您的WinForms应用程序是主机它的MessageBox.show()。调用onbeforeunload的是困难的,它是一个IDispatch指针,其(DISPID 0)返回字符串。添加引用c:\windows\system32\stdole2.tlb并粘贴此代码:   using System.Runtime.InteropServices;  ...   [ComImport, InterfaceType(ComInterfaceType.InterfaceIsIUnknown), Guid(“00020400-0000-0000-C000-000000000046“)]   public interface IDispatch {   int dummy1();   int dummy2();   int dummy3();   [PreserveSig]   int Invoke(int dispIdMember, ref Guid riid, int lcid, int dwFlags,    [In, Out] stdole.DISPPARAMS pDispParams,    [Out, MarshalAs(UnmanagedType.LPArray)] object pVarResult,    [In, Out] stdole.EXCEPINFO pExcepInfo,    [Out, MarshalAs(UnmanagedType.LPArray)] IntPtr pArgErr);   }  你是这样的:    protected override void OnFormClosing(FormClosingEventArgs e) {   var window = (IHTMLWindow2)webBrowser1.Document.Window.DomWindow;   var args = new stdole.DISPPARAMS();   var result = new object;   var except = new stdole.EXCEPINFO();   var idisp = (IDispatch)window.onbeforeunload;   var iid = Guid.Empty;   int hr = idisp.Invoke(0, ref iid, 1033, 1, args, result, except, null);   if (hr == 0) {   if (MessageBox.Show(this, (string)result, “Confirm“,   MessageBoxButtons.OKCancel) == DialogResult.Cancel) e.Cancel = true;   }   base.OnFormClosing(e);    }

linux负载均衡lvs原理详细讲解 什么是lvs负载均衡技术

LVS共有三种模式,优缺点比较如下:NAT模式优点:集群中的物理服务器可以使用任何支持TCP/IP操作系统,物理服务器可以分配Internet的保留私有地址,只有负载均衡器需要一个合法的IP地址。不足:扩展性有限。当服务器节点(普通PC服务器)数据增长到20个或更多时,负载均衡器将成为整个系统的瓶颈,因为所有的请求包和应答包都需要经过负载均衡器再生。假使TCP包的平均长度是536字节的话,平均包再生延迟时间大约为60us(在Pentium处理器上计算的,采用更快的处理器将使得这个延迟时间变短),负载均衡器的最大容许能力为8.93M/s,假定每台物理服务器的平台容许能力为400K/s来计算,负责均衡器能为22台物理服务器计算。TUN模式我们发现,许多Internet服务(例如WEB服务器)的请求包很短小,而应答包通常很大。优点:负载均衡器只负责将请求包分发给物理服务器,而物理服务器将应答包直接发给用户。所以,负载均衡器能处理很巨大的请求量,这种方式,一台负载均衡能为超过100台的物理服务器服务,负载均衡器不再是系统的瓶颈。使用VS-TUN方式,如果你的负载均衡器拥有100M的全双工网卡的话,就能使得整个Virtual Server能达到1G的吞吐量。不足:但是,这种方式需要所有的服务器支持”IP Tunneling”(IP Encapsulation)协议,我仅在Linux系统上实现了这个,如果你能让其它操作系统支持,还在探索之中。DR模式优点:和VS-TUN一样,负载均衡器也只是分发请求,应答包通过单独的路由方法返回给客户端。与VS-TUN相比,VS-DR这种实现方式不需要隧道结构,因此可以使用大多数操作系统做为物理服务器,其中包括:Linux 2.0.36、2.2.9、2.2.10、2.2.12;Solaris 2.5.1、2.6、2.7;FreeBSD 3.1、3.2、3.3;NT4.0无需打补丁;IRIX 6.5;HPUX11等。不足:要求负载均衡器的网卡必须与物理网卡在一个物理段上