// testTinyxmlDlg.cpp : implementation file
//
#include "stdafx.h"
#include "testTinyxml.h"
#include "testTinyxmlDlg.h"
#include "afxdialogex.h"
#include "tinyxml.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// CtestTinyxmlDlg dialog
CtestTinyxmlDlg::CtestTinyxmlDlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CtestTinyxmlDlg::IDD, pParent)
, m_SelDialog(FALSE)
, m_SelMenu(FALSE)
, m_SelST(FALSE)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CtestTinyxmlDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_COMBO1, m_Filter);
DDX_Control(pDX, IDC_EDIT1, m_Path);
DDX_Check(pDX, IDC_CHECK1, m_SelDialog);
DDX_Check(pDX, IDC_CHECK2, m_SelMenu);
DDX_Check(pDX, IDC_CHECK3, m_SelST);
}
BEGIN_MESSAGE_MAP(CtestTinyxmlDlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_BN_CLICKED(IDOK, &CtestTinyxmlDlg::OnBnClickedOk)
ON_BN_CLICKED(IDC_BUTTON1, &CtestTinyxmlDlg::OnBnClickedButton1)
ON_BN_CLICKED(IDC_BUTTON3, &CtestTinyxmlDlg::OnBnClickedButton3)
ON_BN_CLICKED(IDC_BUTTON2, &CtestTinyxmlDlg::OnBnClickedButton2)
END_MESSAGE_MAP()
// CtestTinyxmlDlg message handlers
BOOL CtestTinyxmlDlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
m_Filter.AddString(_T("_T("));
m_Filter.AddString(_T("_TS("));
m_Filter.AddString(_T("Translate("));
m_Filter.SetCurSel(0);
//m_Path.SetWindowText( _T("..\\SupportLib\\Localization\\Language\\Chinese.xml"));
this->m_SelDialog = TRUE;
this->m_SelMenu =TRUE;
this->m_SelST = TRUE;
this->UpdateData(0);
return TRUE; // return TRUE unless you set the focus to a control
}
void CtestTinyxmlDlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CtestTinyxmlDlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
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;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CtestTinyxmlDlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CtestTinyxmlDlg::OnBnClickedOk()
{
// TODO: Add your control notification handler code here
TiXmlDocument *pDocOld = new TiXmlDocument();
if (NULL==pDocOld)
{
return;
}
if (!pDocOld->LoadFile(CW2A(_T("Chineseold.xml")), TIXML_ENCODING_UTF8))
{
MessageBox(_T("Load File Failured!"),_T("ddd"),0);
delete pDocOld;
return;
}
TiXmlElement* pRootElement = pDocOld->RootElement();
TiXmlElement* pStringElement = pRootElement->FirstChildElement();
CStringList list;
while(pStringElement)
{
TiXmlAttribute* attributeOfString = pStringElement->FirstAttribute();
CString EnglishString = CA2W(attributeOfString->Value(), CP_UTF8);
CString LocalizedString = CA2W(pStringElement->GetText(), CP_UTF8);
list.AddTail(EnglishString);
pStringElement = pStringElement->NextSiblingElement();
}
delete pDocOld;
TiXmlDocument *pDocNew = new TiXmlDocument();
if (NULL==pDocNew)
{
return;
}
if (!pDocNew->LoadFile(CW2A(_T("Chinese.xml")), TIXML_ENCODING_UTF8))
{
MessageBox(_T("Load File Failured!"),_T("ddd"),0);
delete pDocNew;
return;
}
pRootElement = pDocNew->RootElement();
pStringElement = pRootElement->FirstChildElement();
CStringList listAppend;
while(pStringElement)
{
TiXmlAttribute* attributeOfString = pStringElement->FirstAttribute();
CString EnglishString = CA2W(attributeOfString->Value(), CP_UTF8);
//list.AddTail(EnglishString);
POSITION pos;
pos = list.GetHeadPosition();
BOOL bFound = 0;
while(pos)
{
CString str = list.GetAt(pos);
if( str == EnglishString)
{
bFound = TRUE;
break;
}
list.GetNext(pos);
}
if(!bFound)
{
CString strFormat;
strFormat.Format(_T("\"%s\""),EnglishString);
listAppend.AddTail(strFormat);
}
pStringElement = pStringElement->NextSiblingElement();
}
CStdioFile cf(_T("append.txt"),CFile::typeText|CFile::modeCreate |CFile::modeWrite);
POSITION pos = listAppend.GetHeadPosition();
while(pos)
{
CString str = listAppend.GetAt(pos);
cf.WriteString(str +_T("\n"));
listAppend.GetNext(pos);
}
cf.Close();
delete pDocNew;
}
void LoadXMLContext(CStringList &xmlList,CString xmlPath)
{
TiXmlDocument *pDoc = new TiXmlDocument();
if (NULL==pDoc)
{
return;
}
if (!pDoc->LoadFile(CW2A(xmlPath), TIXML_ENCODING_UTF8))
{
delete pDoc;
return;
}
TiXmlElement* pRootElement = pDoc->RootElement();
TiXmlElement* pStringElement = pRootElement->FirstChildElement();
CStringList list;
while(pStringElement)
{
TiXmlAttribute* attributeOfString = pStringElement->FirstAttribute();
CString EnglishString = CA2W(attributeOfString->Value(), CP_UTF8);
CString LocalizedString = CA2W(pStringElement->GetText(), CP_UTF8);
xmlList.AddTail(EnglishString);
pStringElement = pStringElement->NextSiblingElement();
}
delete pDoc;
}
void LoadFile( LPCTSTR lpFile, CString & strText)
{
TRY
{
CStdioFile cf(lpFile,CStdioFile::modeRead|CStdioFile::typeText);
CString strLen;
while(cf.ReadString(strLen))
{
strText += strLen + '\n' ;
}
cf.Close();
}CATCH(CFileException,e)
{
e->ReportError();
}
END_CATCH;
}
//need utf8 => unicode.
void LoadRCFile( LPCTSTR lpFile, CString & strText)
{
TRY
{
BYTE nFormat[2] ;
int nFlag;
CStdioFile testCF(lpFile,CStdioFile::modeRead|CStdioFile::typeBinary);
testCF.Read(nFormat,2);
testCF.Close();
if(nFormat[0] ==
没有合适的资源?快使用搜索试试~ 我知道了~
RC 资源文件字串抽取器
共40个文件
h:14个
cpp:10个
log:3个
2星 需积分: 5 15 下载量 173 浏览量
2011-08-30
15:44:11
上传
评论
收藏 313KB ZIP 举报
温馨提示
原创代码 解读微软的RC文件格式,将其中Dialg,menu,以及stringtable部分的字串全部抽出,放入一个rec.xml文件中。
资源推荐
资源详情
资源评论
收起资源包目录
RCStringExtractor.zip (40个子文件)
testTinyxml
testTinyxml.vcxproj.user 143B
tinyxml.h 63KB
resource.h 2KB
testTinyxml.h 535B
SkinDlg
TranslucentButton.cpp 7KB
TranslucentDialog.h 2KB
TranslucentWnd.h 1KB
TranslucentProgressBar.cpp 4KB
Explorer.cpp 630B
Explorer.h 14KB
StandardDialog.h 580B
TranslucentWnd.cpp 2KB
Utility.h 1KB
Utility.cpp 6KB
TranslucentButton.h 2KB
StandardDialog.cpp 2KB
TranslucentDialog.cpp 8KB
TranslucentProgressBar.h 2KB
stdafx.h 2KB
testTinyxml.suo 22KB
testTinyxml.cpp 2KB
targetver.h 314B
tinystr.h 8KB
testTinyxml.rc 13KB
testTinyxmlDlg.cpp 18KB
Debug
RCStringExtractor.Build.CppClean.log 2KB
testTinyxml.log 392B
testTinyxml.lastbuildstate 71B
stdafx.cpp 213B
testTinyxml.vcxproj 6KB
testTinyxmlDlg.h 900B
a.rc 100KB
res.xml 11KB
Release
testTinyxml.log 86B
res
testTinyxml.rc2 806B
testTinyxml.ico 66KB
tinyxml.lib 463KB
testTinyxml.aps 105KB
testTinyxml.vcxproj.filters 2KB
testTinyxml.sln 888B
共 40 条
- 1
资源评论
- KEER8302012-09-26以为是从dll里面抽取呢,原来不是
sundaylover
- 粉丝: 60
- 资源: 14
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功