Click here to Skip to main content
15,893,588 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Setting BGColor to a WebBrowser Control Pin
వేంకటనారాయణ(venkatmakam)5-May-11 22:50
వేంకటనారాయణ(venkatmakam)5-May-11 22:50 
QuestionA strange thing about using SHGetFileInfo to get icon [modified][solved] Pin
yu-jian4-May-11 22:55
yu-jian4-May-11 22:55 
AnswerRe: A strange thing about using SHGetFileInfo to get icon Pin
Michael Dunn5-May-11 13:46
sitebuilderMichael Dunn5-May-11 13:46 
AnswerRe: A strange thing about using SHGetFileInfo to get icon Pin
Iain Clarke, Warrior Programmer6-May-11 4:53
Iain Clarke, Warrior Programmer6-May-11 4:53 
GeneralRe: A strange thing about using SHGetFileInfo to get icon Pin
yu-jian9-May-11 23:44
yu-jian9-May-11 23:44 
QuestionMFC data structures Pin
_Flaviu4-May-11 20:50
_Flaviu4-May-11 20:50 
AnswerRe: MFC data structures Pin
Alexandre GRANVAUD4-May-11 21:44
Alexandre GRANVAUD4-May-11 21:44 
AnswerRe: MFC data structures Pin
Ozer Karaagac5-May-11 1:03
professionalOzer Karaagac5-May-11 1:03 
#include <afxtempl.h>

class CDataPack : public CObject
{
public: // you can determine this access scope
	CStringArray m_saType;	
	CStringArray m_saItem;	
	CStringArray m_saPerson;

	const CDataPack& operator=(const CDataPack& rdp)
	{
		m_saType.Copy(rdp.m_saType);
		m_saItem.Copy(rdp.m_saItem);
		m_saPerson.Copy(rdp.m_saPerson);
		return *this;
	}

	BOOL IsSerializable() const { return TRUE; }

	virtual void Serialize(CArchive& ar)
	{
		m_saType.Serialize(ar);
		m_saItem.Serialize(ar);
		m_saPerson.Serialize(ar);
	}
};

typedef CArray<CDataPack, CDataPack&> CDataPackType;

void AnyFunc()
{
	CString strElement(_T("An Element"));
	CDataPack pkt;

	pkt.m_saType.Add(strElement);  // using public access
	pkt.m_saItem.Add(strElement);
	pkt.m_saPerson.Add(strElement);

	CDataPackType arrData;

	arrData.Add(pkt);

	CFile file; // TODO: you need to open the file
	CArchive ar(&file, CArchive::store);
	arrData.Serialize(ar);
}

If you don't want to use template counterpart, you can also use CObArray or even CPtrArray (or List ones such as CObList, CPtrList, see afxcoll.h). Just beware cleanup of objects.
GeneralRe: MFC data structures Pin
_Flaviu5-May-11 2:30
_Flaviu5-May-11 2:30 
GeneralRe: MFC data structures Pin
Ozer Karaagac5-May-11 5:24
professionalOzer Karaagac5-May-11 5:24 
GeneralRe: MFC data structures Pin
_Flaviu5-May-11 6:25
_Flaviu5-May-11 6:25 
QuestionHow to parse xml (read/write xml file) in vc++ Pin
shiv@nand4-May-11 17:54
shiv@nand4-May-11 17:54 
AnswerRe: How to parse xml (read/write xml file) in vc++ Pin
Hans Dietrich4-May-11 18:00
mentorHans Dietrich4-May-11 18:00 
AnswerRe: How to parse xml (read/write xml file) in vc++ Pin
వేంకటనారాయణ(venkatmakam)4-May-11 19:52
వేంకటనారాయణ(venkatmakam)4-May-11 19:52 
AnswerRe: How to parse xml (read/write xml file) in vc++ Pin
ShilpiP4-May-11 23:11
ShilpiP4-May-11 23:11 
QuestionInvalid class string when using CreateDispatch Pin
Member 29729924-May-11 12:20
Member 29729924-May-11 12:20 
AnswerRe: Invalid class string when using CreateDispatch Pin
Hans Dietrich4-May-11 18:02
mentorHans Dietrich4-May-11 18:02 
GeneralRe: Invalid class string when using CreateDispatch Pin
barneyman4-May-11 18:26
barneyman4-May-11 18:26 
AnswerRe: Invalid class string when using CreateDispatch Pin
Richard MacCutchan4-May-11 21:16
mveRichard MacCutchan4-May-11 21:16 
GeneralRe: Invalid class string when using CreateDispatch Pin
Member 29729924-May-11 22:19
Member 29729924-May-11 22:19 
GeneralRe: Invalid class string when using CreateDispatch Pin
Richard MacCutchan4-May-11 23:05
mveRichard MacCutchan4-May-11 23:05 
GeneralRe: Invalid class string when using CreateDispatch Pin
Member 29729925-May-11 0:04
Member 29729925-May-11 0:04 
GeneralRe: Invalid class string when using CreateDispatch Pin
Richard MacCutchan5-May-11 2:20
mveRichard MacCutchan5-May-11 2:20 
GeneralRe: Invalid class string when using CreateDispatch Pin
Member 29729925-May-11 10:25
Member 29729925-May-11 10:25 
GeneralRe: Invalid class string when using CreateDispatch Pin
Richard MacCutchan5-May-11 21:05
mveRichard MacCutchan5-May-11 21:05 

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.