📄 runlengthdialog.cpp
字号:
// RunlengthDialog.cpp : implementation file
//
#include "stdafx.h"
#include "entropyCoding.h"
#include "RunlengthDialog.h"
#include "Runlength_en.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CRunlengthDialog dialog
CRunlengthDialog::CRunlengthDialog(CWnd* pParent /*=NULL*/)
: CDialog(CRunlengthDialog::IDD, pParent)
{
//{{AFX_DATA_INIT(CRunlengthDialog)
m_infile = _T("");
m_outfile = _T("");
//}}AFX_DATA_INIT
}
void CRunlengthDialog::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CRunlengthDialog)
DDX_Text(pDX, IDC_EDIT1, m_infile);
DDX_Text(pDX, IDC_EDIT2, m_outfile);
//}}AFX_DATA_MAP
}
BEGIN_MESSAGE_MAP(CRunlengthDialog, CDialog)
//{{AFX_MSG_MAP(CRunlengthDialog)
ON_BN_CLICKED(IDC_BUTTON_Open2, OnBUTTONOpen2)
ON_BN_CLICKED(IDC_BUTTON_decode, OnBUTTONdecode)
ON_BN_CLICKED(IDC_BUTTON_open1, OnBUTTONopen1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CRunlengthDialog message handlers
void CRunlengthDialog::OnBUTTONdecode()
{
FILE *ifile,*ofile;
if ((ifile = fopen (m_infile, "rb")) != NULL)
//AfxMessageBox ("ERROR! Cannot Open the Input file.\n");
if ((ofile = fopen (m_outfile, "wb")) != NULL)
//AfxMessageBox ("ERROR! Cannot Open the Output file.\n");
runlength_de(ifile,ofile);
CString info;
info.Format("游程解码结束!输出文件:%s\n输入",m_outfile);//second
AfxMessageBox(info);
}
void CRunlengthDialog::OnOK()
{
FILE *ifile,*ofile;
if ((ifile = fopen (m_infile, "rb")) == NULL)
AfxMessageBox ("ERROR! Cannot Open the Input file.\n");
if ((ofile = fopen (m_outfile, "wb")) == NULL)
AfxMessageBox ("ERROR! Cannot Open the Output file.\n");
runlength_en(ifile,ofile);
CString info;
info.Format("游程编码结束!输出文件:%s\n输入",m_outfile);//second
AfxMessageBox(info);
//CDialog::OnOK();
}
void CRunlengthDialog::OnBUTTONOpen2()
{
UpdateData(true);
static char szFilter[] = "All Files(*.*)|*.*|";
CFileDialog FileDlg( TRUE, NULL,NULL,OFN_HIDEREADONLY, szFilter);
if( FileDlg.DoModal() == IDOK )
{
m_szFilePathName2=FileDlg.GetPathName();
}
else
{
m_szFilePathName2 = "F:\\standard_pictures\\MISSUSA_raw\\lena.raw";
}
m_outfile=m_szFilePathName2;
UpdateData(false);
}
void CRunlengthDialog::OnBUTTONopen1()
{
UpdateData(true);
static char szFilter[] = "raw(*.raw)|*.raw|huf(*.huf)|*.huf|acc(*.acc)|*.acc|run(*.run)|*.run|";
CFileDialog FileDlg( TRUE, NULL,NULL,OFN_HIDEREADONLY, szFilter);
if( FileDlg.DoModal() == IDOK )
{
m_szFilePathName1=FileDlg.GetPathName();
}
else
{
m_szFilePathName1 = "F:\\standard_pictures\\MISSUSA_raw\\lena.raw";
}
m_szFilePathName1=FileDlg.GetPathName();
m_infile=m_szFilePathName1;
m_outfile=m_infile.Left(m_infile.GetLength()-4);
if(m_infile.Right(3)=="raw")
m_outfile=m_outfile+".run";
else
m_outfile=m_outfile+"_De.raw";
UpdateData(false);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -