Click here to Skip to main content
15,913,055 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: RegSetValueEx setting a strange value Pin
Mark Salsbery21-Dec-06 14:13
Mark Salsbery21-Dec-06 14:13 
QuestionControlling a Command Line from a GUI Pin
g51ngh21-Dec-06 8:06
g51ngh21-Dec-06 8:06 
AnswerRe: Controlling a Command Line from a GUI Pin
led mike21-Dec-06 10:15
led mike21-Dec-06 10:15 
QuestionClear screen Pin
ggreekggod21-Dec-06 7:46
ggreekggod21-Dec-06 7:46 
AnswerRe: Clear screen Pin
Maximilien21-Dec-06 7:54
Maximilien21-Dec-06 7:54 
GeneralRe: Clear screen Pin
ggreekggod21-Dec-06 8:26
ggreekggod21-Dec-06 8:26 
GeneralRe: Clear screen Pin
David Crow21-Dec-06 8:55
David Crow21-Dec-06 8:55 
QuestionSaving CObArray objects containing CObArray objects Pin
Ben Aldhouse21-Dec-06 6:27
Ben Aldhouse21-Dec-06 6:27 
I would like to serialize the following CObArray class:

<br />
class CNode : public CSubNode <br />
{<br />
	DECLARE_SERIAL (CNode)<br />
public:<br />
	void Serialize(CArchive &ar);<br />
	CNode();<br />
	virtual ~CNode();<br />
	CObArray * GetSubNodesP() {return &m_oaSubNodes;}<br />
	void SetNodePath(CString inPath) {m_strNodDescr = inPath;}<br />
	CString GetNodePath() {return m_strNodDescr;}<br />
<br />
private:<br />
	int m_iCurPosition;<br />
	CString m_strNodDescr;<br />
	CObArray m_oaSubNodes;<br />
};<br />


Here is the serialization function in the document class....

<br />
void CFTreeBrowserDoc::Serialize(CArchive& ar)<br />
{<br />
<br />
	//m_oaNodes::Serialize(ar);<br />
	m_oaNodes.Serialize(ar);<br />
<br />
}<br />
<br />


...and in CNode...

<br />
<br />
void CNode::Serialize(CArchive &ar)<br />
{<br />
<br />
	m_oaSubNodes.Serialize(ar);<br />
<br />
    // Are we writing?<br />
    if (ar.IsStoring())<br />
        // Write all of the variables, in order<br />
		ar << m_iCurPosition << m_strNodDescr; // << m_oaSubNodes;<br />
<br />
    else<br />
        // Read all of the variables, in order<br />
		ar >> m_iCurPosition >> m_strNodDescr; // >> m_oaSubNodes;<br />
<br />
}<br />
<br />
<br />


...and so far (because I haven't got around to implementing what I want to do with it yet) in the CSubNode class...

<br />
<br />
void CSubNode::Serialize(CArchive &ar)<br />
{<br />
    // Call the ancestor function<br />
    CObject::Serialize(ar);<br />
 <br />
}<br />


Now because I haven't yet got very far at all with this, I have only tried writing and reading values to and from 'm_strNodDescr' in the CNode objects. The program writes these values to a file which it saves. I know this has worked, because I can see the values when I open the file in a generic editor. However, when I load the file back into my application, the array of CNode objects, as far as I can tell, doesn't get re-populated.

Your help and opinions here are much appreciated,

Ben.
QuestionRe: Saving CObArray objects containing CObArray objects Pin
prasad_som21-Dec-06 18:58
prasad_som21-Dec-06 18:58 
AnswerRe: Saving CObArray objects containing CObArray objects [modified] Pin
Ben Aldhouse22-Dec-06 3:18
Ben Aldhouse22-Dec-06 3:18 
GeneralRe: Saving CObArray objects containing CObArray objects Pin
Ben Aldhouse22-Dec-06 3:28
Ben Aldhouse22-Dec-06 3:28 
AnswerRe: Saving CObArray objects containing CObArray objects Pin
Ben Aldhouse23-Mar-07 21:37
Ben Aldhouse23-Mar-07 21:37 
QuestionAssign file type to an application in Windows Pin
VeRtRX21-Dec-06 5:27
VeRtRX21-Dec-06 5:27 
AnswerRe: Assign file type to an application in Windows Pin
David Crow21-Dec-06 5:48
David Crow21-Dec-06 5:48 
AnswerRe: Assign file type to an application in Windows Pin
James R. Twine21-Dec-06 8:58
James R. Twine21-Dec-06 8:58 
AnswerRe: Assign file type to an application in Windows Pin
Cristian Amarie26-Dec-06 6:45
Cristian Amarie26-Dec-06 6:45 
Questioncreate a constructor for a struct Pin
cy163@hotmail.com21-Dec-06 5:07
cy163@hotmail.com21-Dec-06 5:07 
AnswerRe: create a constructor for a struct Pin
James R. Twine21-Dec-06 5:12
James R. Twine21-Dec-06 5:12 
AnswerRe: create a constructor for a struct Pin
Maximilien21-Dec-06 5:27
Maximilien21-Dec-06 5:27 
GeneralRe: create a constructor for a struct Pin
cy163@hotmail.com21-Dec-06 5:38
cy163@hotmail.com21-Dec-06 5:38 
GeneralRe: create a constructor for a struct Pin
David Crow21-Dec-06 5:46
David Crow21-Dec-06 5:46 
GeneralRe: create a constructor for a struct Pin
cy163@hotmail.com21-Dec-06 5:58
cy163@hotmail.com21-Dec-06 5:58 
GeneralRe: create a constructor for a struct Pin
David Crow21-Dec-06 7:08
David Crow21-Dec-06 7:08 
GeneralRe: create a constructor for a struct Pin
James R. Twine21-Dec-06 8:42
James R. Twine21-Dec-06 8:42 
GeneralRe: create a constructor for a struct Pin
David Crow21-Dec-06 8:53
David Crow21-Dec-06 8:53 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.