From 4cda72771765720a6a8721bd8844945c2403afe6 Mon Sep 17 00:00:00 2001 From: QuakeGod <quakegod@sina.com> Date: 星期一, 23 十月 2023 08:52:12 +0800 Subject: [PATCH] fix vcxproj version --- MTerm2/DialogSysRegSet.cpp | 88 ++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 85 insertions(+), 3 deletions(-) diff --git a/MTerm2/DialogSysRegSet.cpp b/MTerm2/DialogSysRegSet.cpp index 586f333..3930109 100644 --- a/MTerm2/DialogSysRegSet.cpp +++ b/MTerm2/DialogSysRegSet.cpp @@ -7,6 +7,15 @@ #include "afxdialogex.h" #include "PropSysReg1.h" + +#include <atlbase.h> +#include <msxml6.h> + +#pragma comment(lib, "msxml6.lib") + +MHash gsd1; + + // CDialogSysRegSet 瀵硅瘽妗� IMPLEMENT_DYNAMIC(CDialogSysRegSet, CDialogEx) @@ -14,7 +23,7 @@ CDialogSysRegSet::CDialogSysRegSet(CWnd* pParent /*=nullptr*/) : CDialogEx(IDD_DIALOG_SYSREG_SET, pParent) { - + } CDialogSysRegSet::~CDialogSysRegSet() @@ -38,6 +47,21 @@ // CDialogSysRegSet 娑堟伅澶勭悊绋嬪簭 +int CDialogSysRegSet::LoadDeviceDescriptionFile() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + gsd1.LoadFromFile(_T("FP0Ext.cfg")); + CString s1; + + s1 = gsd1["configs"]["output1"]; + + SysLog(s1); + + s1 = MyCfg1["dafd"]["sdfdf"]; + + return 0; +} + int CDialogSysRegSet::AddPropPage(CString sName, CDialogEx & rDlg) { // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. @@ -49,11 +73,70 @@ return 0; } +int CDialogSysRegSet::testXmlParser() +{ + // TODO: 鍦ㄦ澶勬坊鍔犲疄鐜颁唬鐮�. + CString s1; + using namespace std; + + // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲 + CoInitialize(NULL); + //瀹氫箟DOM妯″瀷涓殑鏂囨。瀵硅薄 + CComPtr<IXMLDOMDocument> spXmldoc; + //鍒濆鍖栧簱瀵硅薄 + HRESULT hr = spXmldoc.CoCreateInstance(CLSID_DOMDocument60); + s1.Format(_T("Create Instance Hr = %d "), hr); + SysLog(s1); + if (SUCCEEDED(hr)) + { + //璇诲彇 xml 鏂囦欢 + char *pPath = "config1.xml"; + CComBSTR Path = CComBSTR(pPath); + //灏哫ML鏂囦欢瀵煎叆鍐呭瓨涓殑鏂囨。瀵硅薄 + VARIANT_BOOL success; + hr = spXmldoc->load(CComVariant(Path), &success); + s1.Format(_T("Load File Hr = %d "), hr); + SysLog(s1); + CComPtr<IXMLDOMNodeList> spChildren; + + spXmldoc->get_childNodes(&spChildren); + + int i = 0; + long numChildren = 0; + spChildren->get_length(&numChildren); + s1.Format(_T("num of Children = %d "), numChildren); + SysLog(s1); + for (int i = 0; i < numChildren; i++) { + CComPtr<IXMLDOMNode> spNode; + CComBSTR NodeName; + spChildren->get_item(i, &spNode); + spNode->get_nodeName(&NodeName); + CComPtr<IXMLDOMNodeList> spChildren2; + spNode->get_childNodes(&spChildren2); + long numChildren2 = 0; + spChildren2->get_length(&numChildren2); + + CString s2; + s2 = NodeName; + s1.Format(_T("Root node %d name = %s num of Child %d "), i, s2, numChildren2); + SysLog(s1); + } + + // spXmldoc + + // spXmldoc->Release(); + // spXmldoc.Release(); + } + return 0; +} + BOOL CDialogSysRegSet::OnInitDialog() { CDialogEx::OnInitDialog(); - // TODO: 鍦ㄦ娣诲姞棰濆鐨勫垵濮嬪寲 + testXmlParser(); + LoadDeviceDescriptionFile(); + m_listSel1.GetCount(); AddPropPage(_T("宸ヤ綔妯″紡璁剧疆1"), m_propmodecfg1); @@ -325,4 +408,3 @@ */ m_nCurProp = j; } - -- Gitblit v1.9.1