2019-07-27 22:44:32 +08:00
|
|
|
|
锘<EFBFBD>// JencodeDlg.cpp : 瀹炵幇鏂囦欢
|
2014-11-19 00:25:21 +08:00
|
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#include "stdafx.h"
|
|
|
|
|
#include "Jencode.h"
|
|
|
|
|
#include "Gb2Utf8.h"
|
|
|
|
|
#include "AclTrans.h"
|
|
|
|
|
#include "IdxTrans.h"
|
|
|
|
|
#include "JencodeDlg.h"
|
|
|
|
|
#include "DelBOM.h"
|
2019-07-26 16:09:45 +08:00
|
|
|
|
#include "AddBOM.h"
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#include "JencodeDlg.h"
|
|
|
|
|
#include ".\jencodedlg.h"
|
|
|
|
|
|
|
|
|
|
#ifdef _DEBUG
|
|
|
|
|
#define new DEBUG_NEW
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#define WM_USER_TRANS_OVER WM_USER + 100
|
|
|
|
|
#define WM_USER_TRANS_OVER2 WM_USER + 101
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 鐢ㄤ簬搴旂敤绋嬪簭鈥滃叧浜庘€濊彍鍗曢」鐨<E3808D> CAboutDlg 瀵硅瘽妗<E798BD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
class CAboutDlg : public CDialog
|
|
|
|
|
{
|
|
|
|
|
public:
|
|
|
|
|
CAboutDlg();
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 瀵硅瘽妗嗘暟鎹<E69A9F>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
enum { IDD = IDD_ABOUTBOX };
|
|
|
|
|
|
|
|
|
|
protected:
|
2019-07-27 22:44:32 +08:00
|
|
|
|
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 鏀寔
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 瀹炵幇
|
2014-11-19 00:25:21 +08:00
|
|
|
|
protected:
|
|
|
|
|
DECLARE_MESSAGE_MAP()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CDialog::DoDataExchange(pDX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// CJencodeDlg 瀵硅瘽妗<E798BD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CJencodeDlg::CJencodeDlg(CWnd* pParent /*=NULL*/)
|
2019-07-26 17:27:39 +08:00
|
|
|
|
: CDialog(CJencodeDlg::IDD, pParent)
|
|
|
|
|
, m_sIdxPath(_T(""))
|
|
|
|
|
, m_fsPath(_T(""))
|
2014-11-19 00:25:21 +08:00
|
|
|
|
{
|
|
|
|
|
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::DoDataExchange(CDataExchange* pDX)
|
|
|
|
|
{
|
|
|
|
|
CDialog::DoDataExchange(pDX);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BEGIN_MESSAGE_MAP(CJencodeDlg, CDialog)
|
|
|
|
|
ON_WM_SYSCOMMAND()
|
|
|
|
|
ON_WM_PAINT()
|
|
|
|
|
ON_WM_QUERYDRAGICON()
|
|
|
|
|
//}}AFX_MSG_MAP
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_GB2UTF, OnBnClickedButtonGb2utf)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_UTF2GB, OnBnClickedButtonUtf2gb)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON2, OnBnClickedButton2)
|
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON3, OnBnClickedButton3)
|
|
|
|
|
ON_MESSAGE(WM_USER_TRANS_OVER, OnTransOver)
|
|
|
|
|
ON_MESSAGE(WM_USER_TRANS_OVER2, OnTransOver2)
|
|
|
|
|
ON_BN_CLICKED(IDC_ACL_TRANS, OnBnClickedAclTrans)
|
|
|
|
|
ON_BN_CLICKED(IDC_ACL_RESTORE, OnBnClickedAclRestore)
|
|
|
|
|
ON_BN_CLICKED(IDC_IDX_SELECT, OnBnClickedIdxSelect)
|
|
|
|
|
ON_BN_CLICKED(IDC_TRANS_IDX, OnBnClickedTransIdx)
|
|
|
|
|
ON_BN_CLICKED(IDC_DEL_BOM, OnBnClickedDelBom)
|
2017-03-12 14:49:48 +08:00
|
|
|
|
ON_BN_CLICKED(IDC_BUTTON_GB2UNI, &CJencodeDlg::OnBnClickedButtonGb2uni)
|
2019-07-26 16:09:45 +08:00
|
|
|
|
ON_BN_CLICKED(IDC_ADD_BOM, &CJencodeDlg::OnBnClickedAddBom)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
END_MESSAGE_MAP()
|
|
|
|
|
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// CJencodeDlg 娑堟伅澶勭悊绋嬪簭
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
BOOL CJencodeDlg::OnInitDialog()
|
|
|
|
|
{
|
|
|
|
|
CDialog::OnInitDialog();
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 灏哱鈥滃叧浜<E58FA7>...\鈥濊彍鍗曢」娣诲姞鍒扮郴缁熻彍鍗曚腑銆<E88591>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// IDM_ABOUTBOX 蹇呴』鍦ㄧ郴缁熷懡浠よ寖鍥村唴銆<E594B4>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
|
|
|
|
|
ASSERT(IDM_ABOUTBOX < 0xF000);
|
|
|
|
|
|
|
|
|
|
CMenu* pSysMenu = GetSystemMenu(FALSE);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (pSysMenu != NULL) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CString strAboutMenu;
|
|
|
|
|
strAboutMenu.LoadString(IDS_ABOUTBOX);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!strAboutMenu.IsEmpty()) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
pSysMenu->AppendMenu(MF_SEPARATOR);
|
|
|
|
|
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 璁剧疆姝ゅ璇濇鐨勫浘鏍囥€傚綋搴旂敤绋嬪簭涓荤獥鍙d笉鏄璇濇鏃讹紝妗嗘灦灏嗚嚜鍔<E59A9C>
|
|
|
|
|
// 鎵ц姝ゆ搷浣<E690B7>
|
|
|
|
|
SetIcon(m_hIcon, TRUE); // 璁剧疆澶у浘鏍<E6B598>
|
|
|
|
|
SetIcon(m_hIcon, FALSE); // 璁剧疆灏忓浘鏍<E6B598>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲浠g爜
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2019-07-26 16:09:45 +08:00
|
|
|
|
acl::log::open("jencode.log", "jencode");
|
|
|
|
|
logger("started!");
|
|
|
|
|
|
2017-03-12 14:49:48 +08:00
|
|
|
|
//freopen("CONOUT$","w+t",stdout);
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 娣诲姞鐘舵€佹爮
|
2014-11-19 00:25:21 +08:00
|
|
|
|
int aWidths[2] = {50, -1};
|
|
|
|
|
m_wndStatus.Create(WS_CHILD | WS_VISIBLE | WS_BORDER
|
|
|
|
|
| CCS_BOTTOM | SBARS_SIZEGRIP,
|
|
|
|
|
CRect(0,0,0,0), this, 0);
|
|
|
|
|
m_wndStatus.SetParts(2, aWidths);
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("灏辩华", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_wndStatus.SetText("", 1, 0);
|
2019-07-27 22:44:32 +08:00
|
|
|
|
return TRUE; // 闄ら潪璁剧疆浜嗘帶浠剁殑鐒︾偣锛屽惁鍒欒繑鍥<E7B991> TRUE
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnSysCommand(UINT nID, LPARAM lParam)
|
|
|
|
|
{
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if ((nID & 0xFFF0) == IDM_ABOUTBOX) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CAboutDlg dlgAbout;
|
|
|
|
|
dlgAbout.DoModal();
|
2019-07-26 17:27:39 +08:00
|
|
|
|
} else {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CDialog::OnSysCommand(nID, lParam);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 濡傛灉鍚戝璇濇娣诲姞鏈€灏忓寲鎸夐挳锛屽垯闇€瑕佷笅闈㈢殑浠g爜
|
|
|
|
|
// 鏉ョ粯鍒惰鍥炬爣銆傚浜庝娇鐢ㄦ枃妗<E69E83>/瑙嗗浘妯″瀷鐨<E780B7> MFC 搴旂敤绋嬪簭锛<E7B0AD>
|
|
|
|
|
// 杩欏皢鐢辨鏋惰嚜鍔ㄥ畬鎴愩€<E684A9>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnPaint()
|
|
|
|
|
{
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (IsIconic()) {
|
2019-07-27 22:44:32 +08:00
|
|
|
|
CPaintDC dc(this); // 鐢ㄤ簬缁樺埗鐨勮澶囦笂涓嬫枃
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 浣垮浘鏍囧湪宸ヤ綔鐭╁舰涓眳涓<E79CB3>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
int cxIcon = GetSystemMetrics(SM_CXICON);
|
|
|
|
|
int cyIcon = GetSystemMetrics(SM_CYICON);
|
|
|
|
|
CRect rect;
|
|
|
|
|
GetClientRect(&rect);
|
|
|
|
|
int x = (rect.Width() - cxIcon + 1) / 2;
|
|
|
|
|
int y = (rect.Height() - cyIcon + 1) / 2;
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// 缁樺埗鍥炬爣
|
2014-11-19 00:25:21 +08:00
|
|
|
|
dc.DrawIcon(x, y, m_hIcon);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
} else {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CDialog::OnPaint();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
//褰撶敤鎴锋嫋鍔ㄦ渶灏忓寲绐楀彛鏃剁郴缁熻皟鐢ㄦ鍑芥暟鍙栧緱鍏夋爣鏄剧ず銆<E3819A>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
HCURSOR CJencodeDlg::OnQueryDragIcon()
|
|
|
|
|
{
|
|
|
|
|
return static_cast<HCURSOR>(m_hIcon);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::ButtonsEnable(void)
|
|
|
|
|
{
|
|
|
|
|
GetDlgItem(IDC_BUTTON_GB2UTF)->EnableWindow(TRUE);
|
|
|
|
|
GetDlgItem(IDC_BUTTON_UTF2GB)->EnableWindow(TRUE);
|
|
|
|
|
GetDlgItem(IDC_ACL_TRANS)->EnableWindow(TRUE);
|
|
|
|
|
GetDlgItem(IDC_ACL_RESTORE)->EnableWindow(TRUE);
|
|
|
|
|
GetDlgItem(IDC_DEL_BOM)->EnableWindow(TRUE);
|
2019-07-26 16:09:45 +08:00
|
|
|
|
GetDlgItem(IDC_ADD_BOM)->EnableWindow(TRUE);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
BOOL CJencodeDlg::CheckPath(void)
|
|
|
|
|
{
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
GetDlgItem(IDC_EDIT_SPATH)->GetWindowText(m_sPath);
|
|
|
|
|
//MessageBox(m_sPath);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (m_sPath.GetLength() == 0) {
|
2019-07-27 22:44:32 +08:00
|
|
|
|
MessageBox("璇烽€夋嫨婧愮洰褰<EFBFBD>...");
|
2014-11-19 00:25:21 +08:00
|
|
|
|
return FALSE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
m_dPath = m_sPath;
|
|
|
|
|
|
|
|
|
|
//GetDlgItem(IDC_EDIT_DPATH)->GetWindowText(m_dPath);
|
|
|
|
|
//if (m_dPath.GetLength() == 0)
|
|
|
|
|
//{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// MessageBox("璇烽€夋嫨鐩殑鐩綍...");
|
2014-11-19 00:25:21 +08:00
|
|
|
|
// return FALSE;
|
|
|
|
|
//}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::ButtonsDisable(void)
|
|
|
|
|
{
|
|
|
|
|
GetDlgItem(IDC_BUTTON_GB2UTF)->EnableWindow(FALSE);
|
|
|
|
|
GetDlgItem(IDC_BUTTON_UTF2GB)->EnableWindow(FALSE);
|
|
|
|
|
GetDlgItem(IDC_ACL_TRANS)->EnableWindow(FALSE);
|
|
|
|
|
GetDlgItem(IDC_ACL_RESTORE)->EnableWindow(FALSE);
|
|
|
|
|
GetDlgItem(IDC_DEL_BOM)->EnableWindow(FALSE);
|
2019-07-26 16:09:45 +08:00
|
|
|
|
GetDlgItem(IDC_ADD_BOM)->EnableWindow(FALSE);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedButtonGb2utf()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
return;
|
2019-07-26 17:27:39 +08:00
|
|
|
|
}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2017-03-12 14:49:48 +08:00
|
|
|
|
static CGb2Utf8 gb2Utf8("gbk", "UTF-8");
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
gb2Utf8.Init(this->GetSafeHwnd(), m_sPath, m_dPath);
|
|
|
|
|
gb2Utf8.OnTransEnd(WM_USER_TRANS_OVER);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
gb2Utf8.start();
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedButtonUtf2gb()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
MessageBox(m_sPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
static CGb2Utf8 utf2gb("utf-8", "gbk");
|
|
|
|
|
|
|
|
|
|
utf2gb.Init(this->GetSafeHwnd(), m_sPath, m_dPath);
|
|
|
|
|
utf2gb.OnTransEnd(WM_USER_TRANS_OVER);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
utf2gb.start();
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2017-03-12 14:49:48 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedButtonGb2uni()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2017-03-12 14:49:48 +08:00
|
|
|
|
MessageBox(m_sPath);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
static CGb2Utf8 gb2uni("gbk", "UCS2LE");
|
|
|
|
|
|
|
|
|
|
gb2uni.Init(this->GetSafeHwnd(), m_sPath, m_dPath);
|
|
|
|
|
gb2uni.OnTransEnd(WM_USER_TRANS_OVER);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
gb2uni.start();
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedButton2()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CString sPath;
|
|
|
|
|
BROWSEINFO bi;
|
|
|
|
|
char name[MAX_PATH];
|
|
|
|
|
ZeroMemory(&bi, sizeof(BROWSEINFO));
|
|
|
|
|
|
|
|
|
|
bi.hwndOwner = GetSafeHwnd();
|
|
|
|
|
bi.pszDisplayName = name;
|
|
|
|
|
bi.lpszTitle = "Select folder";
|
|
|
|
|
bi.ulFlags = BIF_RETURNONLYFSDIRS;
|
|
|
|
|
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
|
|
|
|
|
if(idl == NULL)
|
|
|
|
|
return;
|
|
|
|
|
SHGetPathFromIDList(idl, sPath.GetBuffer(MAX_PATH));
|
|
|
|
|
|
|
|
|
|
sPath.ReleaseBuffer();
|
|
|
|
|
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (sPath.Right(1) != "\\") {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
sPath += "\\";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_SPATH)->SetWindowText(sPath);
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// CFileDialog file(TRUE,"鏂囦欢","result.txt",OFN_HIDEREADONLY,"FILE(*.*)|*.*||",NULL);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
// if(file.DoModal()==IDOK)
|
|
|
|
|
// {
|
|
|
|
|
// CString pathname;
|
|
|
|
|
//
|
|
|
|
|
// pathname=file.GetPathName();
|
|
|
|
|
// GetDlgItem(IDC_EDIT_SPATH)->SetWindowText(pathname);
|
|
|
|
|
// }
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedButton3()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CString sPath;
|
|
|
|
|
BROWSEINFO bi;
|
|
|
|
|
char name[MAX_PATH];
|
|
|
|
|
ZeroMemory(&bi, sizeof(BROWSEINFO));
|
|
|
|
|
|
|
|
|
|
bi.hwndOwner = GetSafeHwnd();
|
|
|
|
|
bi.pszDisplayName = name;
|
|
|
|
|
bi.lpszTitle = "Select folder";
|
|
|
|
|
bi.ulFlags = BIF_RETURNONLYFSDIRS;
|
|
|
|
|
LPITEMIDLIST idl = SHBrowseForFolder(&bi);
|
|
|
|
|
if(idl == NULL)
|
|
|
|
|
return;
|
|
|
|
|
SHGetPathFromIDList(idl, sPath.GetBuffer(MAX_PATH));
|
|
|
|
|
|
|
|
|
|
sPath.ReleaseBuffer();
|
|
|
|
|
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (sPath.Right(1) != "\\") {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
sPath += "\\";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_EDIT_DPATH)->SetWindowText(sPath);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
afx_msg LRESULT CJencodeDlg::OnTransOver(WPARAM uID, LPARAM lEvent)
|
|
|
|
|
{
|
|
|
|
|
CString msg;
|
|
|
|
|
|
|
|
|
|
ButtonsEnable();
|
2019-07-27 22:44:32 +08:00
|
|
|
|
msg.Format("鑰楁椂锛<EFBFBD>%d 绉<>", time(NULL) - m_nBegin);
|
|
|
|
|
m_wndStatus.SetText("瀹屾垚", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_wndStatus.SetText(msg, 1, 0);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
return 0;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
afx_msg LRESULT CJencodeDlg::OnTransOver2(WPARAM uID, LPARAM lEvent)
|
|
|
|
|
{
|
|
|
|
|
CString msg;
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_TRANS_IDX)->EnableWindow(TRUE);
|
2019-07-27 22:44:32 +08:00
|
|
|
|
msg.Format("鑰楁椂锛<EFBFBD>%d 绉<>", time(NULL) - m_nBegin);
|
|
|
|
|
m_wndStatus.SetText("瀹屾垚!", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_wndStatus.SetText(msg, 1, 0);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
return 0;
|
2014-11-19 00:25:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedAclTrans()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
return;
|
2019-07-26 17:27:39 +08:00
|
|
|
|
}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
static CAclTrans aclTrans;
|
|
|
|
|
|
|
|
|
|
aclTrans.Init(this->GetSafeHwnd(), m_sPath);
|
|
|
|
|
aclTrans.OnTransEnd(WM_USER_TRANS_OVER);
|
|
|
|
|
aclTrans.Run();
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedAclRestore()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
return;
|
2019-07-26 17:27:39 +08:00
|
|
|
|
}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
static CAclTrans aclTrans;
|
|
|
|
|
|
|
|
|
|
aclTrans.Init(this->GetSafeHwnd(), m_sPath);
|
|
|
|
|
aclTrans.OnTransEnd(WM_USER_TRANS_OVER);
|
|
|
|
|
aclTrans.Run(FALSE);
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedDelBom()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
return;
|
2019-07-26 17:27:39 +08:00
|
|
|
|
}
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
static CDelBOM delBom;
|
|
|
|
|
delBom.Init(this->GetSafeHwnd(), m_sPath);
|
|
|
|
|
delBom.OnDeleted(WM_USER_TRANS_OVER);
|
2019-07-26 16:09:45 +08:00
|
|
|
|
delBom.start();
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2019-07-26 16:09:45 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedAddBom()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (!CheckPath()) {
|
2019-07-26 16:09:45 +08:00
|
|
|
|
return;
|
2019-07-26 17:27:39 +08:00
|
|
|
|
}
|
2019-07-26 16:09:45 +08:00
|
|
|
|
|
|
|
|
|
static CAddBOM addBom;
|
|
|
|
|
addBom.Init(this->GetSafeHwnd(), m_sPath);
|
|
|
|
|
addBom.OnAdded(WM_USER_TRANS_OVER);
|
|
|
|
|
addBom.start();
|
|
|
|
|
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
ButtonsDisable();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedIdxSelect()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
|
|
|
|
CFileDialog file(TRUE,"鏂囦欢","search.idx",OFN_HIDEREADONLY,"FILE(*.*)|*.*||",NULL);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if(file.DoModal()==IDOK) {
|
2014-11-19 00:25:21 +08:00
|
|
|
|
CString pathname;
|
|
|
|
|
|
|
|
|
|
pathname=file.GetPathName();
|
|
|
|
|
GetDlgItem(IDC_IDX_PATH)->SetWindowText(pathname);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void CJencodeDlg::OnBnClickedTransIdx()
|
|
|
|
|
{
|
2019-07-27 22:44:32 +08:00
|
|
|
|
// TODO: 鍦ㄦ娣诲姞鎺т欢閫氱煡澶勭悊绋嬪簭浠g爜
|
2014-11-19 00:25:21 +08:00
|
|
|
|
static CIdxTrans idxTrans;
|
|
|
|
|
|
|
|
|
|
UpdateData(TRUE);
|
|
|
|
|
GetDlgItem(IDC_IDX_PATH)->GetWindowText(m_fsPath);
|
2019-07-26 17:27:39 +08:00
|
|
|
|
if (m_fsPath.GetLength() == 0) {
|
2019-07-27 22:44:32 +08:00
|
|
|
|
MessageBox("璇烽€夋嫨绱㈠紩鏂囦欢...");
|
2014-11-19 00:25:21 +08:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
GetDlgItem(IDC_TRANS_IDX)->EnableWindow(FALSE);
|
|
|
|
|
idxTrans.Init(this->GetSafeHwnd(), m_fsPath);
|
|
|
|
|
idxTrans.OnTransEnd(WM_USER_TRANS_OVER2);
|
|
|
|
|
idxTrans.Run();
|
2019-07-27 22:44:32 +08:00
|
|
|
|
m_wndStatus.SetText("杩愯", 0, 0);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
m_nBegin = time(NULL);
|
|
|
|
|
}
|