📄 fileopendlgex.cpp
字号:
// FileOpenDlgEx.cpp : implementation file
//
#include "stdafx.h"
#include "VisualJava.h"
#include "FileOpenDlgEx.h"
#include <dlgs.h>
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CFileOpenDlgEx
IMPLEMENT_DYNAMIC(CFileOpenDlgEx, CFileDialog)
CFileOpenDlgEx::CFileOpenDlgEx(BOOL bOpenFileDialog, LPCTSTR lpszDefExt, LPCTSTR lpszFileName,
DWORD dwFlags, LPCTSTR lpszFilter, CWnd* pParentWnd) :
CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName, dwFlags, lpszFilter, pParentWnd)
{
m_ofn.Flags |= OFN_EXPLORER|OFN_ENABLETEMPLATE;
m_ofn.lpTemplateName = MAKEINTRESOURCE (CFileOpenDlgEx::IDD);
m_szBigBuffer[0]='\0';
m_ofn.lpstrFile = m_szBigBuffer;
if (dwFlags & OFN_ALLOWMULTISELECT)
{
// MFC only provides a 260 character buffer for lpstrFile
// This is not sufficient when you may be expecting a large number of files.
m_ofn.nMaxFile = sizeof(m_szBigBuffer);
if (lpszFileName != NULL)
lstrcpyn(m_szBigBuffer, lpszFileName, sizeof(m_szBigBuffer));
}
else
m_ofn.nMaxFile = _MAX_PATH;
}
BEGIN_MESSAGE_MAP(CFileOpenDlgEx, CFileDialog)
//{{AFX_MSG_MAP(CFileOpenDlgEx)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
void CFileOpenDlgEx::DoDataExchange(CDataExchange* pDX)
{
CFileDialog::DoDataExchange(pDX);
//{{AFX_DATA_MAP(CAppType)
// NOTE: the ClassWizard will add DDX and DDV calls here
DDX_Text(pDX,IDC_COMBO_FORMAT, m_szpFormat);
//}}AFX_DATA_MAP
}
BOOL CFileOpenDlgEx::OnInitDialog()
{
CFileDialog::OnInitDialog();
if(m_ofn.Flags & OFN_HIDEREADONLY)
{
GetDlgItem(IDC_COMBO_FORMAT)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_STATIC_OPENAS)->ShowWindow(SW_HIDE);
GetDlgItem(IDC_STATIC_FOLDER)->ShowWindow(SW_SHOW);
GetDlgItem(IDC_STATIC_FOLDER)->SetWindowText(m_folder);
}
else
{
CComboBox* wndCombo = (CComboBox*)GetDlgItem(IDC_COMBO_FORMAT);
wndCombo->AddString("Auto");
wndCombo->AddString("Text");
wndCombo->AddString("Binary");
wndCombo->AddString("Resource");
wndCombo->SetCurSel(0);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
void CFileOpenDlgEx::HideReadOnly(CString szpMsg)
{
m_folder = szpMsg;
m_ofn.Flags |= OFN_HIDEREADONLY;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -