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

📄 stgraphdlg.cpp

📁 利用BMP存储图像的冗余
💻 CPP
字号:
// StGraphDlg.cpp : implementation file
//

#include "stdafx.h"
#include "StGraph.h"
#include "StGraphDlg.h"

#include ".\stgraphdlg.h"
#include ".\bmphermitcrab.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CStGraphDlg dialog

CStGraphDlg::CStGraphDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CStGraphDlg::IDD, pParent)
	, m_strSrcFile(_T("j:\\op.txt"))
	, m_strDestFile(_T("j:\\1.bmp"))
	, m_strPassword(_T("hello"))
	, m_strResultFile(_T("j:\\h1.bmp"))
	, m_strRDestFile(_T("j:\\h1.bmp"))
	, m_strRPassword(_T("hello"))
	, m_strRPath(_T("j:\\"))
{
	//{{AFX_DATA_INIT(CStGraphDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
	// Note that LoadIcon does not require a subsequent DestroyIcon in Win32
	m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}

void CStGraphDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CStGraphDlg)
	//}}AFX_DATA_MAP
	DDX_Text(pDX, IDC_EDIT1, m_strSrcFile);
	DDX_Text(pDX, IDC_EDIT4, m_strDestFile);
	DDX_Text(pDX, IDC_EDIT3, m_strPassword);
	DDX_Text(pDX, IDC_EDIT5, m_strResultFile);
	DDX_Text(pDX, IDC_EDIT6, m_strRDestFile);
	DDX_Text(pDX, IDC_EDIT8, m_strRPassword);
	DDX_Text(pDX, IDC_EDIT7, m_strRPath);
}

BEGIN_MESSAGE_MAP(CStGraphDlg, CDialog)
	//{{AFX_MSG_MAP(CStGraphDlg)
	ON_WM_PAINT()
	ON_WM_QUERYDRAGICON()
	//}}AFX_MSG_MAP
	ON_BN_CLICKED(IDC_BUTTON5, OnBnClickedButton5)
	ON_BN_CLICKED(IDC_BUTTON7, OnBnClickedButton7)
	ON_BN_CLICKED(IDC_BUTTON6, OnBnClickedButton6)
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CStGraphDlg message handlers

BOOL CStGraphDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// Set the icon for this dialog.  The framework does this automatically
	//  when the application's main window is not a dialog
	SetIcon(m_hIcon, TRUE);			// Set big icon
	SetIcon(m_hIcon, FALSE);		// Set small icon
	
	// TODO: Add extra initialization here
	return TRUE;  // return TRUE  unless you set the focus to a control
}

// If you add a minimize button to your dialog, you will need the code below
//  to draw the icon.  For MFC applications using the document/view model,
//  this is automatically done for you by the framework.

void CStGraphDlg::OnPaint() 
{
	if (IsIconic())
	{
		CPaintDC dc(this); // device context for painting

		SendMessage(WM_ICONERASEBKGND, (WPARAM) dc.GetSafeHdc(), 0);

		// Center icon in client rectangle
		int cxIcon = GetSystemMetrics(SM_CXICON);
		int cyIcon = GetSystemMetrics(SM_CYICON);
		CRect rect;
		GetClientRect(&rect);
		int x = (rect.Width() - cxIcon + 1) / 2;
		int y = (rect.Height() - cyIcon + 1) / 2;

		// Draw the icon
		dc.DrawIcon(x, y, m_hIcon);
	}
	else
	{
		CDialog::OnPaint();
	}
}

// The system calls this to obtain the cursor to display while the user drags
//  the minimized window.
HCURSOR CStGraphDlg::OnQueryDragIcon()
{
	return (HCURSOR) m_hIcon;
}

void CStGraphDlg::OnBnClickedButton5()
{
	//Hide
	UpdateData();
	CBmpHermitCrab bmpHider;
	if(bmpHider.Hermit(m_strDestFile,m_strSrcFile,m_strPassword,m_strResultFile)){
		AfxMessageBox("Hide Ok");
	}
}

void CStGraphDlg::OnBnClickedButton7()
{
	//check
	UpdateData();
	CBmpHermitCrab bmpHider;
	if(bmpHider.IsHermitCrabBMPFile(m_strRDestFile)){
		AfxMessageBox("Hermit Crab BMP File!");
	}
}

void CStGraphDlg::OnBnClickedButton6()
{
	//recover
	UpdateData();
	CBmpHermitCrab bmpHider;
	if(bmpHider.RecoverCrabFile(m_strRDestFile,m_strRPassword,m_strRPath)){
		AfxMessageBox("Recover OK!");
	}
}

⌨️ 快捷键说明

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