openfile.cpp

来自「这个是我用mfc写的一个pl0的编译器」· C++ 代码 · 共 50 行

CPP
50
字号
// openfile.cpp : implementation file
//

#include "stdafx.h"
#include "MFCpl0.h"
#include "openfile.h"

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

/////////////////////////////////////////////////////////////////////////////
// Copenfile

IMPLEMENT_DYNAMIC(Copenfile, CFileDialog)

Copenfile::Copenfile(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
		DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
		CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{

				m_pszFile = new TCHAR[2048]; //set a 2K buffer to hold selected files
	m_pszFile[0] = '\0'; //initialize pointer;
}
Copenfile::~Copenfile()
{
	
	if (m_pszFile != NULL)
		delete [] m_pszFile; //cleanup
}
int Copenfile::DoModal()
{
	ASSERT_VALID(this);
	ASSERT(m_ofn.Flags & OFN_ALLOWMULTISELECT); //make sure multiple file selection is on

	m_ofn.lpstrFile = m_pszFile; //initialize the OPENFILENAME structure
	m_ofn.nMaxFile = 2048;

	return CFileDialog::DoModal();
}

BEGIN_MESSAGE_MAP(Copenfile, CFileDialog)
	//{{AFX_MSG_MAP(Copenfile)
		// NOTE - the ClassWizard will add and remove mapping macros here.
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

⌨️ 快捷键说明

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