如图建一个基于对话框
代码如下 一个头文件一个cpp
// CopyFileDlg.h : 头文件
//
#pragma once
#include "afxcmn.h"
#include "afxwin.h"
UINT MyThreadFun(LPVOID pParam);
// CCopyFileDlg 对话框
class CCopyFileDlg : public CDialog
{
// 构造
public:
CCopyFileDlg(CWnd* pParent = NULL); // 标准构造函数
// 对话框数据
enum { IDD = IDD_COPYFILE_DIALOG };
HANDLE hStop;
HANDLE hExit;
CWinThread * pThreadpause;
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
// 实现
protected:
HICON m_hIcon;
// 生成的消息映射函数
virtual BOOL OnInitDialog();
afx_msg void OnSysCommand(UINT nID, LPARAM lParam);
afx_msg void OnPaint();
afx_msg HCURSOR OnQueryDragIcon();
DECLARE_MESSAGE_MAP()
public:
CString m_srcPath;
CString m_desPath;
afx_msg void OnBnClickedButtonsrcpath();
afx_msg void OnBnClickedButtondespath();
afx_msg void OnBnClickedButtonstat();
afx_msg void OnBnClickedButtonstop();
afx_msg void OnBnClickedButtonpause();
afx_msg void OnTimer(UINT_PTR nIDEvent);
CProgressCtrl m_ProgressCopy;
afx_msg void OnDestroy();
afx_msg LRESULT Do_process(WPARAM wParam,LPARAM lParam);
afx_msg LRESULT CCopyFileDlg::ShowFile(WPARAM wParam, LPARAM lParam);
CEdit m_EditShowName;
int m_iStatus;
};
cpp
#include "stdafx.h"
#include "CopyFile.h"
#include "CopyFileDlg.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
static int countset = 0;
#define WM_USER_PROCESS (WM_USER+100)
#define WM_USER_SHOW (WM_USER+101)
void myCopyDirectory(CString source, CString target,CWnd * pWndMsg);
// 用于应用程序“关于”菜单项的 CAboutDlg 对话框
void myCopyDirectory(CString source, CString target);
VOID GetInfo(CString csPath, long& iDirCnt, long& iFileCnt);
//INT myCount(CString source);
static int nl