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

📄 hongmodoc.cpp

📁 虹膜图像预处理
💻 CPP
字号:
// hongmoDoc.cpp : implementation of the CHongmoDoc class
//

#include "stdafx.h"
#include "hongmo.h"

#include "hongmoDoc.h"
#include "GlobalApi.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CHongmoDoc

IMPLEMENT_DYNCREATE(CHongmoDoc, CDocument)

BEGIN_MESSAGE_MAP(CHongmoDoc, CDocument)
	//{{AFX_MSG_MAP(CHongmoDoc)
	ON_COMMAND(ID_FILE_SAVE_AS, OnFileSaveAs)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CHongmoDoc construction/destruction

CHongmoDoc::CHongmoDoc()
{
	// TODO: add one-time construction code here
	InitDocVariable();
}

CHongmoDoc::~CHongmoDoc()
{
	FreeDocVariable();
}

BOOL CHongmoDoc::OnNewDocument()
{
	if (!CDocument::OnNewDocument())
		return FALSE;

	// TODO: add reinitialization code here
	// (SDI documents will reuse this document)

	return TRUE;
}



/////////////////////////////////////////////////////////////////////////////
// CHongmoDoc serialization

void CHongmoDoc::Serialize(CArchive& ar)
{
	m_pDibInit->Serialize(ar);   //已更改
	if (ar.IsStoring())
	{
		// TODO: add storing code here
	}
	else
	{
		// TODO: add loading code here
	}
}

/////////////////////////////////////////////////////////////////////////////
// CHongmoDoc diagnostics

#ifdef _DEBUG
void CHongmoDoc::AssertValid() const
{
	CDocument::AssertValid();
}

void CHongmoDoc::Dump(CDumpContext& dc) const
{
	CDocument::Dump(dc);
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CHongmoDoc commands
int CHongmoDoc::InitDocVariable()
{
	m_pDibInit = new CDib;

	
	m_pDibTest = new CDib;

	m_nColorIndex = 0;

	//--------------------------------------------

	return 0;
}
int CHongmoDoc::FreeDocVariable()
{
	delete m_pDibInit;
	m_pDibInit = NULL;

	// added by tanhc in 2002-7-30, used to test some function
	delete m_pDibTest ;
	m_pDibTest = NULL ;

	//--------------------------------------------

	return 0;
}

void CHongmoDoc::OnFileSaveAs() 
{
	// TODO: Add your command handler code here
	CString strSaveFileType = "位图文件 (*.bmp)|*.bmp; *.dib|All Files (*.*)|*.*||";
	CFileDialog FileDlg(FALSE, "*.bmp", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, strSaveFileType);

	CFile fileOpen ;
	if( FileDlg.DoModal() == IDOK ) 
	{
		if(!fileOpen.Open( FileDlg.GetPathName() , CFile::modeCreate|CFile::modeWrite ))
		{
			AfxMessageBox("cannot create the file to save!");
			return;
		}
		if( !m_pDibInit->Write( &fileOpen ) )
		{
			return;
		}
		fileOpen.Close();
	}
}

⌨️ 快捷键说明

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