C++中嵌入网页(duilib编辑框的实现)
2012-02-22 13:15
357 查看
效果
View Code
2.加载控件
index.html
editor可以从网上下载
View Code
<HorizontalLayout > <Label text="邮件内容:" width ="60" height="16" textcolor="#FF666666"/> <ActiveX name="ie" clsid="{8856F961-340A-11D0-A96B-00C04FD705A2}" delaycreate="false"/> </HorizontalLayout>
2.加载控件
void CMailDialog::Init() { SetIcon(IDR_MAINFRAME); // Set big icon m_pCloseBtn = static_cast<CButtonUI*>(paint_manager_.FindControl(_T("closebtn"))); CActiveXUI* pActiveXUI = static_cast<CActiveXUI*>(paint_manager_.FindControl(_T("ie"))); if( pActiveXUI ) { IWebBrowser2* pWebBrowser = NULL; pActiveXUI->GetControl(IID_IWebBrowser2, (void**)&pWebBrowser); if( pWebBrowser != NULL ) { std::string strPath=ConfigManager::instance()->getSkinPath()+"\\MailEditor\\index.html"; int Len=::MultiByteToWideChar (CP_ACP, 0, strPath.c_str(), -1, NULL, 0); wchar_t *buf=new wchar_t [Len]; MultiByteToWideChar(CP_ACP,0,strPath.c_str(),-1,buf,Len); std::wstring wstrFilePath=std::wstring(buf); delete[] buf; pWebBrowser->Navigate((BSTR)(wstrFilePath.c_str()),NULL,NULL,NULL,NULL); pWebBrowser->Release(); } } }
index.html
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <meta name="save" content="history"> <title>邮件编辑器</title> <link rel="stylesheet" type="text/css" href="editor/comm.css" /> <script language="javascript" src="editor/all.js"></script> <script language="javascript" src="editor/editor.js"></script> <script language="javascript" src="editor/editor_toolbar.js"></script> <script language="javascript"> function checkform(){ if(document.form1.title.value ==""){ alert("请输入标题"); return false; } var v = DoProcess(); if(v != true){ alert("请输入内容"); return false; } } function ReSet() { var clientWidth=document.body.clientWidth-10; var clientHeight=document.body.clientHeight-40; document.getElementById("HtmlEditor").style.width=clientWidth+'px'; document.getElementById("HtmlEditor").style.height=clientHeight+'px'; var SourceEditorobj=document.getElementById("SourceEditor"); if(SourceEditorobj) { SourceEditorobj.style.width=clientWidth+'px'; SourceEditorobj.style.height=clientHeight+'px'; } } </script> <style type="text/css"> .prompt {border:1px dotted #ccc;background-color:#ffe;color:#666;padding: 5px 5px 5px 30px;line-height:120%;width:1600px} </style> </head> <body onResize="ReSet()" scroll= "no" > <table border="0" cellpadding="2" cellspacing="1"> <form name="form1" method="post" action="?action=saveadd" target="_blank" onSubmit="return checkform();"> <tr> <td><textarea id="content" name="content" style="display:none;"></textarea> <script language="javascript"> gFrame = 0;//1-在框架中使用编辑器 gContentId = "content";//要载入内容的content ID OutputEditorLoading(); </script> <iframe id="HtmlEditor" class="editor_frame" frameborder="0" marginheight="0" marginwidth="0" style="width:100%;height:100%;overflow:visible;" hideFocus></iframe> </td> </tr> </form> </table> </body> </html>
editor可以从网上下载
相关文章推荐
- 百度编辑器使用 嵌入ci (可灵活运用,建立数据库,写入并读出,实现用户自定义网页页面内容)
- Symbian下用C++实现网页浏览的代码
- 使用springmvc,jsp,结合网页文本编辑器kindEditor实现基本博客编辑功能
- [网页]双击文字后实现编辑文本功能
- c++实现平面上的形状编辑
- 使用c++技术实现下载网页
- 关于网页中编码gb2312,big5,gbk,utf-8识别的最新方法的探讨和c++的实现
- Autoit 脚本编辑,操作嵌入的网页
- 在C++中嵌入汇编实现DLL注入
- 循环冗余校验码CRC算法的C++实现 - IaWeN's Blog-iawen,原创,安全,破解视频,网页设计,影视后期,AE特效 - 我喜欢这样自由的随手涂鸦,因为我喜欢风……
- Qt5.6 c++与网页html/js的交互实现
- c++实现平面上的形状编辑
- c++实现嵌入.exe文件到程序中
- 使用html2canvas实现网页截图并嵌入到PDF
- @font-face(css3属性)实现在网页中嵌入任意字体
- 实现网页表格数据的及时编辑
- 使用@font-face 属性 实现在网页中嵌入任意字体
- WebBrowser实现编辑网页
- PHP如何实现嵌入网页功能思路
- c++实现平面上的形状编辑