specfiledlg.cpp

来自「vc.net内幕系列源码」· C++ 代码 · 共 63 行

CPP
63
字号
// SpecFileDlg.cpp : implementation file
//

#include "stdafx.h"
#include "Ex07b.h"
#include "SpecFileDlg.h"


// CSpecialFileDialog dialog

IMPLEMENT_DYNAMIC(CSpecialFileDialog, CFileDialog)
CSpecialFileDialog::CSpecialFileDialog(BOOL bOpenFileDialog,
		LPCTSTR lpszDefExt, LPCTSTR lpszFileName, DWORD dwFlags,
		LPCTSTR lpszFilter, CWnd* pParentWnd)
	: CFileDialog(bOpenFileDialog, lpszDefExt, lpszFileName,
		dwFlags, lpszFilter, pParentWnd)
{
	m_ofn.Flags |= OFN_ENABLETEMPLATE;
	m_ofn.lpTemplateName = MAKEINTRESOURCE(IDD_FILESPECIAL);
	m_ofn.lpstrTitle = "Delete File";
	m_bDeleteAll = FALSE;
}

CSpecialFileDialog::~CSpecialFileDialog()
{
}

void CSpecialFileDialog::DoDataExchange(CDataExchange* pDX)
{
	CFileDialog::DoDataExchange(pDX);
}


BEGIN_MESSAGE_MAP(CSpecialFileDialog, CFileDialog)
	ON_BN_CLICKED(IDC_DELETE, OnBnClickedDelete)
END_MESSAGE_MAP()


// CSpecialFileDialog message handlers

BOOL CSpecialFileDialog::OnInitDialog()
{
	BOOL bRet = CFileDialog::OnInitDialog();
	if (bRet == TRUE) {
		GetParent()->GetDlgItem(IDOK)->SetWindowText("Delete");
	}

    HICON hIcon = AfxGetApp()->LoadIcon(IDI_MYICON);
    GetParent()->SetIcon(hIcon, TRUE);        // Set big icon
    GetParent()->SetIcon(hIcon, FALSE);       // Set small icon

	return bRet;
}

void CSpecialFileDialog::OnBnClickedDelete()
{
	m_bDeleteAll = TRUE;
	// 0x480 is the child window ID of the File Name edit control
	//  (as determined by SPYXX)
	GetParent()->GetDlgItem(0x480)->GetWindowText(m_strFilename);
	GetParent()->SendMessage(WM_COMMAND, IDCANCEL);
}

⌨️ 快捷键说明

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