Files
interactive/application/sp-console3/ConsoleTransfer/FileExistsDlg.cpp
T
2026-08-07 17:38:18 +09:00

114 lines
3.0 KiB
C++

// FileExistsDlg.cpp : 구현 파일입니다.
//
#include "stdafx.h"
#include "ConsoleTransfer.h"
#include "FileExistsDlg.h"
// CFileExistsDlg 대화 상자입니다.
IMPLEMENT_DYNAMIC(CFileExistsDlg, CDialog)
CFileExistsDlg::CFileExistsDlg(CWnd* pParent /*=NULL*/)
: CDialog(CFileExistsDlg::IDD, pParent)
, m_sFile1(_T(""))
, m_sSize1(_T(""))
, m_sTime1(_T(""))
, m_sFile2(_T(""))
, m_sSize2(_T(""))
, m_sTime2(_T(""))
, m_nSelectedAction(0)
, m_bAlways(FALSE)
{
}
CFileExistsDlg::~CFileExistsDlg()
{
}
void CFileExistsDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_FILEEXISTS_ICON1, m_stcIcon1);
DDX_Control(pDX, IDC_FILEEXISTS_ICON2, m_stcIcon2);
DDX_Text(pDX, IDC_FILEEXISTS_FILE1, m_sFile1);
DDX_Text(pDX, IDC_FILEEXISTS_SIZE1, m_sSize1);
DDX_Text(pDX, IDC_FILEEXISTS_DATE1, m_sTime1);
DDX_Text(pDX, IDC_FILEEXISTS_FILE2, m_sFile2);
DDX_Text(pDX, IDC_FILEEXISTS_SIZE2, m_sSize2);
DDX_Text(pDX, IDC_FILEEXISTS_DATE2, m_sTime2);
DDX_Radio(pDX, IDC_FILEEXISTS_ACTION1, m_nSelectedAction);
DDX_Check(pDX, IDC_FILEEXISTS_ALWAYS, m_bAlways);
}
BEGIN_MESSAGE_MAP(CFileExistsDlg, CDialog)
ON_WM_DESTROY()
ON_WM_CLOSE()
END_MESSAGE_MAP()
// CFileExistsDlg 메시지 처리기입니다.
BOOL CFileExistsDlg::OnInitDialog()
{
USES_CONVERSION;
CDialog::OnInitDialog();
// TODO: 여기에 추가 초기화 작업을 추가합니다.
SHFILEINFO shfi;
DWORD dwSHAttr1, dwSHAttr2;
dwSHAttr1 = m_sSize1 == "" ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
if (!SHGetFileInfo(m_sFile1.Mid(m_sFile1.ReverseFind('.')), dwSHAttr1, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON))
shfi.iIcon = 1;
m_stcIcon1.SetIcon(shfi.hIcon);
dwSHAttr2 = m_sSize2 == "" ? FILE_ATTRIBUTE_DIRECTORY : FILE_ATTRIBUTE_NORMAL;
if (!SHGetFileInfo(m_sFile2.Mid(m_sFile2.ReverseFind('.')), dwSHAttr2, &shfi, sizeof(shfi), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON))
shfi.iIcon = 1;
m_stcIcon2.SetIcon(shfi.hIcon);
if (m_bDownload)
GetDlgItem(IDC_FILEEXISTS_ACTION2)->SetWindowText("이어받기");
else {
GetDlgItem(IDC_FILEEXISTS_ACTION2)->SetWindowText("이어올리기");
// GetDlgItem(IDC_FILEEXISTS_ACTION2)->EnableWindow(FALSE);
}
if (dwSHAttr1 == FILE_ATTRIBUTE_DIRECTORY || dwSHAttr2 == FILE_ATTRIBUTE_DIRECTORY)
GetDlgItem(IDC_FILEEXISTS_ACTION2)->EnableWindow(FALSE);
if (!m_bDownload && dwSHAttr1 != dwSHAttr2) {
GetDlgItem(IDC_FILEEXISTS_ACTION1)->EnableWindow(FALSE);
m_nSelectedAction = 2;
UpdateData(FALSE);
}
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX-Eigenschaftenseiten sollten FALSE zur?kgeben
}
void CFileExistsDlg::OnDestroy()
{
HICON hIcon;
hIcon = m_stcIcon1.GetIcon();
if (hIcon)
DestroyIcon(hIcon);
hIcon = m_stcIcon2.GetIcon();
if (hIcon)
DestroyIcon(hIcon);
CDialog::OnDestroy();
}
void CFileExistsDlg::OnClose()
{
m_nSelectedAction = FILEEXISTS_SKIP;
CDialog::OnClose();
}