Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

Read and Write application parameters in XML

, 30 Jun 2003
This article provides an easy way to load and save the parameters of an application in XML format.
// ParamIO_DemoDlg.h : header file
//

#if !defined(AFX_PARAMIO_DEMODLG_H__FEAA69B3_806C_40AD_8DF4_5085FF3D9831__INCLUDED_)
#define AFX_PARAMIO_DEMODLG_H__FEAA69B3_806C_40AD_8DF4_5085FF3D9831__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include <string>
class ParamIO;

/////////////////////////////////////////////////////////////////////////////
// CParamIO_DemoDlg dialog

class CParamIO_DemoDlg : public CDialog
{
// Construction
public:
	CParamIO_DemoDlg(CWnd* pParent = NULL);	// standard constructor

// Dialog Data
	//{{AFX_DATA(CParamIO_DemoDlg)
	enum { IDD = IDD_PARAMIO_DEMO_DIALOG };
	double	_fontSize;
	int	_blue;
	int	_green;
	int	_red;
	CString	m_text;
	CString	m_fontName;
	//}}AFX_DATA

	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CParamIO_DemoDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);	// DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	HICON m_hIcon;

	std::string _fontName;

	void loadParameters(const char *filename);
	void saveParameters(const char *filename);

   void readParameters(const ParamIO &inXml);
   void writeParameters(ParamIO &outXml);

	// Generated message map functions
	//{{AFX_MSG(CParamIO_DemoDlg)
	virtual BOOL OnInitDialog();
	afx_msg void OnPaint();
	afx_msg HCURSOR OnQueryDragIcon();
	afx_msg void OnLoad();
	afx_msg void OnSave();
	afx_msg void OnCompare();
	afx_msg void OnXmlDialog();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_PARAMIO_DEMODLG_H__FEAA69B3_806C_40AD_8DF4_5085FF3D9831__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

Share

About the Author

Arnaud Brejeon
Web Developer
China China
I've been living & working in Tokyo since 2000 . I'm currently working in Gentech Corp. (www.gen.co.jp), developing computer vision applications, especially in the field of face detection.
 
I've been interested in C++ for quite a while and recently discovered Ruby.
 
My hobbies are trekking, japanese food, yoga & onsens.

| Advertise | Privacy | Mobile
Web04 | 2.8.141015.1 | Last Updated 1 Jul 2003
Article Copyright 2001 by Arnaud Brejeon
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid