Codejock Forums Homepage
Forum Home Forum Home > Codejock Products > Visual C++ MFC > Syntax Edit
  New Posts New Posts RSS Feed - how to write data to CXTPPropExchangeXMLNode
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

how to write data to CXTPPropExchangeXMLNode

 Post Reply Post Reply
Author
Message
yangyanhui View Drop Down
Senior Member
Senior Member


Joined: 20 August 2020
Status: Offline
Points: 131
Post Options Post Options   Thanks (0) Thanks(0)   Quote yangyanhui Quote  Post ReplyReply Direct Link To This Post Topic: how to write data to CXTPPropExchangeXMLNode
    Posted: 08 September 2020 at 4:40am
now I can read data from CXTPPropExchangeXMLNode using PX_STRING but I do not know how to write data into it. I have tried PX_STRING to write but failed
Back to Top
mgampi View Drop Down
Senior Member
Senior Member
Avatar

Joined: 14 July 2003
Status: Offline
Points: 1201
Post Options Post Options   Thanks (0) Thanks(0)   Quote mgampi Quote  Post ReplyReply Direct Link To This Post Posted: 08 September 2020 at 5:09am
Hi;
Here's a code snipped that shows how to store. Keep in mind that you have to write all items you want to put into the XML file:

        CXTPPropExchangeXMLNode px(FALSE, 0, _T("Settings"));

        if (px.OnBeforeExchange())
        {
            CXTPPropExchangeSection pxSubNode1(px.GetSection(_T("Service")));
            VERIFY(PX_Long(&pxSubNode1, _T("TraceLevel"), TraceLevel_, logINFO));
            VERIFY(PX_String(&pxSubNode1, _T("User"),    TheUser));
            VERIFY(PX_String(&pxSubNode1, _T("DB-Service"),  TheService));
            VERIFY(PX_Long(&pxSubNode1, _T("DB-Interval"), Interval_));
            CXTPPropExchangeSection pxSubNode2(px.GetSection(_T("Parameters")));
            VERIFY(PX_Bool(&pxSubNode2, _T("ExtendedSampleCount"), UseExtendedSampleCount_, FALSE));
            VERIFY(PX_Bool(&pxSubNode2, _T("ShowEmptyRows"), ShowEmptyRows_, FALSE));
            VERIFY(PX_Bool(&pxSubNode2, _T("InvalidateHeatIfNoConsumption"), InvalidateHeatIfNoConsumption_, FALSE));

            if(!CreateDirectory(pszPath, nullptr))             
            {
                if (GetLastError()!=ERROR_ALREADY_EXISTS) {
                    return false;
                }
            }
            _tcscat_s(pszPath, _T("\\Options.xml"));
            if (px.SaveToFile(pszPath)==S_OK)
                return true;
        }

Hope this helps.
Martin

Product: Xtreme Toolkit v 22.1.0, new Projects v 24.0.0
Platform: Windows 10 v 22H2 (64bit)
Language: VC++ 2022
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.172 seconds.