processdlg.cpp

来自「通过vc语言从任意一个文件夹的读出文件名和路径操作的程序」· C++ 代码 · 共 103 行

CPP
103
字号
// ProcessDlg.cpp : implementation file
//

#include "stdafx.h"
#include "ExtractFileList.h"
#include "ProcessDlg.h"

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

DWORD volatile g_dwFileCount = 0;

/////////////////////////////////////////////////////////////////////////////
// CProcessDlg dialog


CProcessDlg::CProcessDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CProcessDlg::IDD, pParent)
{
	//{{AFX_DATA_INIT(CProcessDlg)
		// NOTE: the ClassWizard will add member initialization here
	//}}AFX_DATA_INIT
}


void CProcessDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	//{{AFX_DATA_MAP(CProcessDlg)
		// NOTE: the ClassWizard will add DDX and DDV calls here
	//}}AFX_DATA_MAP
}


BEGIN_MESSAGE_MAP(CProcessDlg, CDialog)
	//{{AFX_MSG_MAP(CProcessDlg)
	ON_WM_TIMER()
	ON_WM_LBUTTONDOWN()
    ON_MESSAGE(WM_FIND_OVER, OnFindOver)
	ON_BN_CLICKED(IDC_CLOSE, OnClose)
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CProcessDlg message handlers

BOOL CProcessDlg::OnInitDialog()
{
    CDialog::OnInitDialog();
    
    
    // TODO: Add extra initialization here
    
    HWND hWndMain = AfxGetApp()->GetMainWnd()->GetSafeHwnd();
    HWND hWndThis = this->GetSafeHwnd();
    ::PostMessage(hWndMain, WM_SAVE_HWND, 0, (LPARAM)hWndThis);

    this->SetTimer(1, 10, NULL);
    m_bIsOver = FALSE;
    return TRUE;  // return TRUE  unless you set the focus to a control
}

void CProcessDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
	PostMessage(WM_NCLBUTTONDOWN, HTCAPTION, MAKELPARAM(point.x, point.y));
	CDialog::OnLButtonDown(nFlags, point);
}

void CProcessDlg::OnTimer(UINT nIDEvent) 
{
	m_strInfo.Format(_T("Searching file...\n %u file found."), g_dwFileCount);
	GetDlgItem(IDC_INFO)->SetWindowText(m_strInfo);
    Invalidate();
	CDialog::OnTimer(nIDEvent);
}


LRESULT CProcessDlg::OnFindOver(WPARAM wParam, LPARAM lParam)
{
    this->KillTimer(1);
    m_bIsOver = TRUE;
	m_strInfo.Format("Searching file Over!\n %u file found.", g_dwFileCount);
	GetDlgItem(IDC_INFO)->SetWindowText(m_strInfo);
	GetDlgItem(IDC_CLOSE)->SetWindowText(_T("&OK"));
	UpdateData(FALSE);
    return 0;
}

void CProcessDlg::OnClose() 
{
    if (m_bIsOver)
    {
        CDialog::OnOK();
    }
    else
    {
        CDialog::OnCancel();
    }
}

⌨️ 快捷键说明

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