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安全错误
数据库的锁怎样保障安全
上海游卡网络技术有限公司
北京龙商公社互联网科技发展
网络安全在大几开始学
java怎么连数据库
扬州数据库账户怎么激活注册
直播软件开发系统怎么解决
网络安全法 重大突发事件
计算机网络技术管理答案
确保我市网络安全稳定
stata重命名数据库
怎么样把数据库倒入sql
国家网络安全宣传周讲解
平顶山网络技术推荐厂家
软件开发常用语言
软件开发参考文献外文
零基础自学计算机软件开发
drogon数据库
远程sql数据库连接不
万象酒店服务器配置
云小福软件开发
网络技术的运用步骤
每个铁路局都有网络安全中心么
泗阳网络技术招聘信息
软件开发范式的变革
威县网络安全宣传报道
软件开发项目怎么操作
软件开发spa项目是什么意思
服务器php数据库读者
关于数据库的说法错误的是
信用卡 bin 数据库