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

📄 dialogfileview.cpp

📁 类似于文件浏览器的vc++应用程序,容易使用,能进行各种文件操作.
💻 CPP
字号:
// DialogFileView.cpp : implementation file
//

#include "stdafx.h"
#include "FileDialogView.h"
#include "DialogFileView.h"
#include "DialogThread.h"

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

#define WM_USR_INIT_FINISHED (WM_USER + 101)

/////////////////////////////////////////////////////////////////////////////
// CDialogFileView

IMPLEMENT_DYNAMIC(CDialogFileView, CFileDialog)

CDialogFileView::CDialogFileView(CDialogThread& rThreadRunningDlg)
		: m_rThreadRunningDlg(rThreadRunningDlg),
		CFileDialog(TRUE, NULL, _T("*.*"), 
		OFN_ALLOWMULTISELECT | OFN_ENABLEHOOK | OFN_HIDEREADONLY, 
		_T("All Files (*.*)|*.*||"), NULL)
{
	m_ofn.Flags &= ~OFN_ENABLESIZING;
}


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


BOOL CDialogFileView::EnumChildProc(HWND hWnd, LPARAM)
{	
	CString szClassName;
	::GetClassName(hWnd,szClassName.GetBuffer(32),32);

	if(strcmp(strlwr((LPSTR)(LPCTSTR)szClassName),"toolbarwindow32") == 0)
	{
		CDialogFileWnd::hWndToolBar = hWnd;
		return FALSE;
	}
	return TRUE;
}

void CDialogFileView::OnInitDone()
{
	ASSERT_VALID(this);
	ASSERT(!GetParent()->IsWindowVisible());
	PostMessage(WM_USR_INIT_FINISHED);
	LocationToolbar();
}

BOOL CDialogFileView::OnInitDialog() 
{
	CWnd* pParent = GetParent();

	VERIFY(::SetWindowLong(*pParent, GWL_STYLE, WS_CHILD | WS_CLIPCHILDREN));
	VERIFY(::SetParent(*pParent,  m_rThreadRunningDlg.m_hWndParent));
	VERIFY(::SetWindowPos(*pParent, NULL, 0, 0, 0, 0,SWP_NOSIZE | SWP_NOMOVE | SWP_NOZORDER | SWP_FRAMECHANGED ));
	if(pParent)
		pParent->SetDlgCtrlID(m_rThreadRunningDlg.m_nID);

	CFileDialog::OnInitDialog();
	
	HideControl(IDOK);
	HideControl(IDCANCEL);
	HideControl(stc2);
	HideControl(stc3);
	HideControl(stc4);
	HideControl(cmb1);
	HideControl(edt1);

	return TRUE;  // return TRUE unless you set the focus to a control
}

BOOL CDialogFileView::OnFileNameOK()
{
	return TRUE;
}


void CDialogFileView::LocationToolbar()
{
	EnumChildWindows((HWND)::GetParent(m_hWnd), CDialogFileView::EnumChildProc, (LPARAM)NULL);
}

void CDialogFileView::OnFolderChange()
{
	CRect rect;
	GetParent()->GetClientRect(&rect);
	GetParent()->SendMessage(WM_SIZE,0,MAKELPARAM(rect.Width(), rect.Height()));
}

LRESULT CDialogFileView::OnInitFinished(WPARAM, LPARAM)
{
	m_rThreadRunningDlg.m_wndFileBrowse.SubclassWindow(*GetParent());
	m_rThreadRunningDlg.m_pMainWnd = &m_rThreadRunningDlg.m_wndFileBrowse;
	VERIFY(SetEvent(m_rThreadRunningDlg.m_hEventCreated));
	return 1;
}

⌨️ 快捷键说明

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