基于WORD文档的防篡改水印系统设计与实现(10)
时间:2016-12-28 13:15 来源:毕业论文 作者:毕业论文 点击:次
{wf[i].color=RGB(255,254,255);} if ((num[tempm+1]>'8') && (num[tempm+2]<='8') && (num[tempm+3]<='8')) {wf[i].color=RGB(255,254,254);} if ((num[tempm+1]<='8') && (num[tempm+2]>'8') && (num[tempm+3]>'8')) {wf[i].color=RGB(254,255,255);} if ((num[tempm+1]<='8') && (num[tempm+2]>'8') && (num[tempm+3]<='8')) {wf[i].color=RGB(254,255,254);} if ((num[tempm+1]<='8') && (num[tempm+2]<='8') && (num[tempm+3]>'8')) {wf[i].color=RGB(254,254,255);} if ((num[tempm+1]<='8') && (num[tempm+2]<='8') && (num[tempm+3]<='8')) {wf[i].color=RGB(254,254,254);} } font.AttachDispatch (sel.GetFont()); sel.MoveLeft(COleVariant((short)1),COleVariant((short)1),COleVariant((short)0)); (7)水印嵌入后会生成新的WORD文档.加入后缀为watermark在当前目录下,如图3.3所示。 sel.HomeKey(COleVariant((short)6),COleVariant((short)0)); wfilename=wfilename.Left(wfilename.GetLength()-4)+"watermark"+wfilename.Right(4); appDoc.SaveAs(COleVariant(wfilename), COleVariant((short)0), vFalse, COleVariant(""), vFalse, COleVariant(""), vFalse, vFalse, vFalse, vFalse, vFalse, vFalse, vFalse, vTrue, vFalse,vFalse); 图3.3 新建嵌入水印文档 3.2.2水印的提取模块 (1)打开有水印的WORD文档,然后输入密钥以检测水印正确性,提取界面如图3.4所示。 void CWordwaterDlg::OnJcwater() { CQLwater JCwater; wrongflag=1; tempsum=0; if (IDOK==JCwater.DoModal()) { switch (JCwater.m_editm) { case 1:m=3;p=1;break; case 2:m=3;p=1;break; case 3:m=3;p=1;break; case 4:m=4;p=3;break; case 5:m=7;p=4;break; case 6:m=7;p=4;break; case 7:m=7;p=4;break; case 8:m=11;p=7;break; case 9:m=11;p=7;break; } tempm=m; n=m*tempn; wfilename=JCwater.FileName; _Application app; COleVariant covTrue((short)TRUE), covFalse((short)FALSE), covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR); if(!app.CreateDispatch("Word.Application")) { AfxMessageBox("Couldn't start Word."); } else { app.SetVisible(TRUE); (责任编辑:qin) |