openwebkitsharp出现COM对象与其基础RCW分开后就不能再使用的示例分析
发表于:2024-10-20 作者:千家信息网编辑
千家信息网最后更新 2024年10月20日,这期内容当中小编将会给大家带来有关openwebkitsharp出现COM对象与其基础RCW分开后就不能再使用的示例分析,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获
千家信息网最后更新 2024年10月20日openwebkitsharp出现COM对象与其基础RCW分开后就不能再使用的示例分析
这期内容当中小编将会给大家带来有关openwebkitsharp出现COM对象与其基础RCW分开后就不能再使用的示例分析,文章内容丰富且以专业的角度为大家分析和叙述,阅读完这篇文章希望大家可以有所收获。
Open-Webkit-Sharp实验:
private void button1_Click(object sender, EventArgs e) { webKitBrowser.UseJavaScript = true; webKitBrowser.Navigate("http://localhost/index.html"); webKitBrowser.ShowJavaScriptAlertPanel += webKitBrowser_ShowJavaScriptAlertPanel; webKitBrowser.DocumentCompleted += webKitBrowser_DocumentCompleted; } void webKitBrowser_ShowJavaScriptAlertPanel(object sender, WebKit.ShowJavaScriptAlertPanelEventArgs e) { //MessageBox.Show("msg:" + e.Message);//最好不要在这个事件中show,否则容易混乱出错 MessageBox.Show(e.Message); Console.WriteLine(sender.ToString() + ":"+e.Message); } private void webKitBrowser_Load(object sender, EventArgs e) { webKitBrowser.GetScriptManager.ScriptObject = this; } private void button2_Click(object sender, EventArgs e) { //string strScript = "messageBox(document.getElementById(\"testelement\").innerText = \"123456\")"; //webKitBrowser.StringByEvaluatingJavaScriptFromString(strScript); WebKit.JSCore.JSValue V = webKitBrowser.GetScriptManager.CallFunction("test", new object[] { "zs", "addrr" }); //Console.WriteLine("jsvalue=" + V.ToString()); this.Text = webKitBrowser.DocumentTitle; } private void button3_Click(object sender, EventArgs e) { webKitBrowser.Navigate("http://www.taobao.com");//("http://www.pudn.com/Download/item/id/4061758.html"); //("https://www.baidu.com"); }
先点button1(以便启用script),再点button3,然后关闭程序主窗体,就出现:COM 对象与其基础 RCW 分开后就不能再使用
网上有相应分析,其实说白了,就是C#中没有相应处理COM中相关资源,想来想去,我添加将事件去掉代码:
private void Form1_FormClosed(object sender, FormClosedEventArgs e)
{
webKitBrowser.ShowJavaScriptAlertPanel -= webKitBrowser_ShowJavaScriptAlertPanel;
webKitBrowser.DocumentCompleted -= webKitBrowser_DocumentCompleted;
}
然后一切都OK了。
上述就是小编为大家分享的openwebkitsharp出现COM对象与其基础RCW分开后就不能再使用的示例分析了,如果刚好有类似的疑惑,不妨参照上述分析进行理解。如果想知道更多相关知识,欢迎关注行业资讯频道。
分析
基础
对象
示例
事件
内容
就是
混乱
说白了
专业
中小
代码
内容丰富
文章
更多
最好
知识
程序
窗体
篇文章
数据库的安全要保护哪些东西
数据库安全各自的含义是什么
生产安全数据库录入
数据库的安全性及管理
数据库安全策略包含哪些
海淀数据库安全审计系统
建立农村房屋安全信息数据库
易用的数据库客户端支持安全管理
连接数据库失败ssl安全错误
数据库的锁怎样保障安全
json自动创建数据库
天津日语翻译软件开发
物理科技小论文关于互联网
数据库运维工是干什么的
数据库完整性教程
高中 赴日 软件开发
奉节软件开发哪家好
通州区网络技术一体化
数据库出生日期怎么算年纪
党建数据库建设方案
网络安全法改变
python数据库画图
vivo 软件开发面经
完美世界游戏服务器怎么买
服务器响应错误请联系管理员
汕头电商软件开发方案
我国网络安全的法律体系
龙粳31种子数据库
亚博海南网络技术
卓智软件开发
临沂智慧城管软件开发
c更新数据库
java服务器读取本地文件夹
联合国贸易数据库中的农产品代码
数据库是前端还是java
数据库查答案的软件
dazy咋看服务器
服务器出现问题如何排查问题
oracle数据库中表被锁
金陵科技学院网络安全