【com编程】IE浏览器(右键扩展功能总结版)
2012-04-22 15:45
260 查看
序言:大家是不是莫名其妙,我怎么什么都搀和上两脚。搞起这个高深的COM编程来了。呵呵……这是帮同学做的一个小东西,由于以前拿这个比赛过,今天由于业务需要又用上了,所以又拉我来做一下这个。都是兄弟,放下手中的活帮哥们做了。
需求:在IE菜单中,添加右键。点击右键调用javaScript,执行相应功能。
步骤:以管理员身份打开VS2005,新建ATL工程,
动态获取当前位置,并写入注册表中
ananlyse.htm
注册dll的文件
copy analyse.htm %windir%
copy db_operation_pop.htm %windir%
regsvr32 sentiment_plugin.dll /s
总之,不容易把相对路径写上,还是用绝对路径简单。
还有好多,不愿意总结了,就把关键的总结上来了。如果感兴趣,可以留言索要相关内容
需求:在IE菜单中,添加右键。点击右键调用javaScript,执行相应功能。
步骤:以管理员身份打开VS2005,新建ATL工程,
动态获取当前位置,并写入注册表中
void OnChange() { WCHAR buf[128]; GetCurrentDirectory(128,(LPTSTR)buf); WCHAR name[14]=L"\\analyse.htm"; CRegKey key; key.Create(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Internet Explorer\\MenuExt\\&分析")); wcscat(buf,name); key.SetStringValue( _T("(默认)"), buf); key.SetDWORDValue(_T("Contexts"),48); }
ananlyse.htm
<script language="JavaScript"> var parentwin = external.menuArguments; var doc = parentwin.document; var sel = doc.selection; var rng = sel.createRange(); var str = encodeURI(new String(rng.text)); if(0 < str.length) { var url = "http://10.100.68.1/classify_analyse/query_emotion.php?content=" + str; openwindow(url, "情感分析对话框",800,600); } else { alert("请选择文本内容"); } function openwindow(url,name,iWidth,iHeight) { var iTop = (window.screen.availHeight - 30 - iHeight) / 2; //获得窗口的垂直位置; var iLeft = (window.screen.availWidth - 10 - iWidth) / 2; //获得窗口的水平位置; var customed = "toolbar=no,menubar=no,scrollbars=yes,resizable=yes,location=no,status=no"; var windowFeatures = "height=" + iHeight + ",innerHeight=" + iHeight + ",width=" + iWidth + ",innerWidth=" + iWidth + ",top=" + iTop + ",left=" + iLeft + "," + customed; window.open(url, name, windowFeatures); } </script>
注册dll的文件
copy analyse.htm %windir%
copy db_operation_pop.htm %windir%
regsvr32 sentiment_plugin.dll /s
总之,不容易把相对路径写上,还是用绝对路径简单。
还有好多,不愿意总结了,就把关键的总结上来了。如果感兴趣,可以留言索要相关内容
相关文章推荐
- 【com编程】IE浏览器(右键扩展功能总结版)
- 【com编程】IE浏览器(右键扩展功能总结版)
- 【com编程】IE浏览器(右键扩展功能总结版)
- CListCtrl控件功能扩展(滚动条)总结
- CListCtrl控件功能扩展总结(三)
- CBoard框架使用总结五--扩展菜单配置功能
- VB实现右键扩展菜单以及按钮触发扩展菜单功能
- CListCtrl控件功能扩展总结
- CListCtrl控件功能扩展总结
- Java程序员必看--扩展鼠标右键菜单功能
- 扩展系统功能——装饰模式(四):装饰模式总结
- CListCtrl控件功能扩展总结
- IE浏览器右键菜单分享扩展
- 扩展系统功能——装饰模式(四):透明与半透明装饰模式,装饰模式注意事项,装饰模式总结
- flume各组件功能及扩展总结
- 关于浏览器扩展--给你的网站增加浏览器右键收藏功能
- CListCtrl控件功能扩展总结
- Java程序员必看--扩展鼠标右键菜单功能
- 使用 zTree 右键菜单功能的总结
- CListCtrl控件功能扩展总结