www.pudn.com > Clean.rar > DelTempFolder.cpp


// DelTempFolder.cpp : implementation file 
// 
 
#include "stdafx.h" 
#include "Clean.h" 
#include "DelTempFolder.h" 
#include  
 
 
 
#ifdef _DEBUG 
#define new DEBUG_NEW 
#undef THIS_FILE 
static char THIS_FILE[] = __FILE__; 
#endif 
 
///////////////////////////////////////////////////////////////////////////// 
// CDelTempFolder dialog 
 
 
CDelTempFolder::CDelTempFolder(CWnd* pParent /*=NULL*/) 
	: CDialog(CDelTempFolder::IDD, pParent) 
{ 
	//{{AFX_DATA_INIT(CDelTempFolder) 
		// NOTE: the ClassWizard will add member initialization here 
	//}}AFX_DATA_INIT 
} 
 
 
void CDelTempFolder::DoDataExchange(CDataExchange* pDX) 
{ 
	CDialog::DoDataExchange(pDX); 
	//{{AFX_DATA_MAP(CDelTempFolder) 
	DDX_Control(pDX, IDC_STATIC_HINT, m_Hint); 
	DDX_Control(pDX, IDC_LIST_ALLFILE, m_List); 
	//}}AFX_DATA_MAP 
} 
 
 
BEGIN_MESSAGE_MAP(CDelTempFolder, CDialog) 
	//{{AFX_MSG_MAP(CDelTempFolder) 
	ON_BN_CLICKED(IDC_BUTTON_FIND, OnButtonFind) 
	ON_BN_CLICKED(IDC_BUTTON_DELETE, OnButtonDelete) 
	//}}AFX_MSG_MAP 
END_MESSAGE_MAP() 
 
///////////////////////////////////////////////////////////////////////////// 
// CDelTempFolder message handlers 
 
BOOL CDelTempFolder::OnInitDialog()  
{ 
	CDialog::OnInitDialog(); 
	 
	// TODO: Add extra initialization here 
	 
	return TRUE;  // return TRUE unless you set the focus to a control 
	              // EXCEPTION: OCX Property Pages should return FALSE 
} 
 
void CDelTempFolder::OnButtonFind()  
{ 
	// TODO: Add your control notification handler code here 
	UINT	count =0 , i=0; 
	TCHAR	szTempFolder[255] = {'\0'}; 
	TCHAR	szWinDir[255] = {'\0'}; 
	CString strPath; 
 
	m_List.ResetContent(); 
 
	if(GetTempPath(MAX_PATH, szTempFolder))  
	{ 
		strPath.Format("%s", szTempFolder); 
		FFind(strPath); 
	} 
	 
	if(GetWindowsDirectory(szWinDir, MAX_PATH)) 
	{ 
		UINT len = lstrlen(szWinDir); 
		if(szWinDir[len-1] != _T('\\')) lstrcat(szWinDir, _T("\\")); 
		strPath.Format("%sTemp\\", szTempFolder); 
		FFind(strPath); 
	} 
 
	count = m_List.GetCount(); 
	CString str; 
	str.Format("查到[%d]个文件", count); 
	m_Hint.SetWindowText(str);		 
} 
 
void CDelTempFolder::OnButtonDelete()  
{ 
	UINT  i=0; 
	CStringArray sa; 
	CString strBuff; 
	UINT count = m_List.GetCount(); 
	if(count==0) return; 
	for(i=0;i