Click here to Skip to main content
15,879,535 members
Articles / Desktop Programming / MFC

Import/Export Registry Sections as XML

Rate me:
Please Sign up or sign in to vote.
4.33/5 (16 votes)
21 Jan 20033 min read 165.6K   6.1K   73  
Export registry sections as XML to simplify registry diffs
This article details a tool aimed to import/export registry sections in XML format, to make registry diff easier in practice.
#pragma once





class registryxmlDoc; // forward declaration


class registryxmlTree : public CTreeView
{
protected: // create from serialization only
	registryxmlTree();
	DECLARE_DYNCREATE(registryxmlTree)

// Members
protected :
	CImageList	m_imglDrives;			// main image list
	HTREEITEM	m_hItem;
	BOOL		m_hItemBOOL;			// tells the m_hItem value is valid

	HTREEITEM	m_hItemFirstSel;		// Init to NULL in constructor
	BOOL		m_bCtrlClick;			// used to know we are ctrl-clicking items


public:
	registryxmlDoc* GetDocument();

// Operations
public:



	// multiple selection
	//

	void		OnSelectionChanged(CString &strPath);
	void		ClearSelection(HTREEITEM hBaseItem);
	BOOL		SelectItems(HTREEITEM hItemFrom, HTREEITEM hItemTo);
	HTREEITEM	GetFirstSelectedItem();
	HTREEITEM	GetFirstSelectedItem( HTREEITEM hBaseItem );
	HTREEITEM	GetNextSelectedItem( HTREEITEM hItem );
	int			GetSelectedCount(HTREEITEM hBaseItem);




	// helpers
	//

	BOOL		IsExpanded(HTREEITEM hItem);

	void		OnSaveAsXml(BOOL bFakedXml);


	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(registryxmlTree)
	public:
	virtual void OnDraw(CDC* pDC);  // overridden to draw this view
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	protected:
	virtual void OnInitialUpdate(); // called first time after construct
	virtual BOOL OnPreparePrinting(CPrintInfo* pInfo);
	virtual void OnBeginPrinting(CDC* pDC, CPrintInfo* pInfo);
	virtual void OnEndPrinting(CDC* pDC, CPrintInfo* pInfo);
	//}}AFX_VIRTUAL


	

// Implementation
public:
	virtual ~registryxmlTree();
#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif

protected:
	CString GetPathFromNode(HTREEITEM hItem);


// Generated message map functions
protected:
	//{{AFX_MSG(registryxmlTree)
		// NOTE - the ClassWizard will add and remove member functions here.
		afx_msg int		OnCreate(LPCREATESTRUCT);
		afx_msg	void	OnDestroy();

		afx_msg void	OnSelChanged (NMHDR*,LRESULT*);
		afx_msg void	OnRightClick(NMHDR * pNotifyStruct, LRESULT* result);
		afx_msg void	OnExpand(NMHDR *pnmh,LRESULT *pResult);
		afx_msg void	OnKeyDown( UINT, UINT, UINT ); 
		afx_msg void	OnLButtonDown(UINT nFlags, CPoint point);
	
		afx_msg void	OnSaveAsXml();
		afx_msg void	OnSaveAsFakedXml();

		//    DO NOT EDIT what you see in these blocks of generated code !
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
};


/////////////////////////////////////////////////////////////////////////////

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


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.


Written By
France France
Addicted to reverse engineering. At work, I am developing business intelligence software in a team of smart people (independent software vendor).

Need a fast Excel generation component? Try xlsgen.

Comments and Discussions