⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 xianshidlg.cpp

📁 基于变换域的信息隐藏技术
💻 CPP
字号:
// XIANSHIDLG.cpp : implementation file
//

#include "stdafx.h"
#include "数字水印技术.h"
#include "XIANSHIDLG.h"
#include "SCANTXT_TOWRITE.h"
#include "数字水印技术Doc.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CXIANSHIDLG dialog


CXIANSHIDLG::CXIANSHIDLG(CWnd* pParent /*=NULL*/)
	: CDialog(CXIANSHIDLG::IDD, pParent)
{
	//{{AFX_DATA_INIT(CXIANSHIDLG)
	m_sshow = _T("");
	//}}AFX_DATA_INIT
}


void CXIANSHIDLG::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CXIANSHIDLG)
	DDX_Text(pDX, IDC_EDIT1, m_sshow);
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CXIANSHIDLG, CDialog)
	//{{AFX_MSG_MAP(CXIANSHIDLG)
	ON_BN_CLICKED(IDC_BUTTONSAVE, OnButtonsave)
	ON_BN_CLICKED(IDC_BUTTONBIT, OnButtonbit)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CXIANSHIDLG message handlers

void CXIANSHIDLG::OnButtonsave() 
{
	// TODO: Add your control notification handler code here
	UpdateData(true);
	CFile fp;
	LPCTSTR filename;
    CSCANTXT_TOWRITE filedlg;
	if(filedlg.DoModal()==IDOK)
	{
		filename=(LPCTSTR)filedlg.m_sfilename;
		fp.Open(filename,CFile::modeWrite|CFile::modeCreate);
        char *str=new char[m_sshow.GetLength()];
		int i;
        for(i=0;i<m_sshow.GetLength();i++)
			str[i]=m_sshow.GetAt(i);
		fp.Write(str,m_sshow.GetLength());
		fp.SeekToBegin();
		delete[]str;
		fp.Close();
	}
	UpdateData(false);
}

void CXIANSHIDLG::OnButtonbit() 
{
	// TODO: Add your control notification handler code here
	 UpdateData(true); 
     int i,j,k=0;
	 CFile fp;
	 CFileDialog dlg(1,"txt","*.txt");
	 if(dlg.DoModal()==IDOK)
		 fp.Open((LPCTSTR)dlg.GetPathName(),CFile::modeCreate|CFile::modeWrite);

	 char ch,*str=new char[m_sshow.GetLength()*8];
	 for(i=0;i<m_sshow.GetLength();i++)
	 {
		  ch=m_sshow.GetAt(i);
		  for(j=7;j>=0;j--)
		  {
		    str[k++]=((ch>>j)&1)+48;
		  }

	 }
	 str[m_sshow.GetLength()*8]='\0';
     fp.Write(str,8*m_sshow.GetLength());
     fp.Close();
	 UpdateData(false);
     
	
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -