This is how I add data to the CArray:
Code:
BOOL ZeroPacketData::SetData(ZeroPacket* Data)
{
if( Data == NULL )
{
//! Do Error
return FALSE;
}
if( !Data->IsLoaded() )
{
//! Do Error
return FALSE;
}
m_Packets.Add(Data);
return TRUE;
}
EDIT: forgot the allocation:
Code:
LRESULT CStageZeroNetworkAnalysisView::OnNewPacket(WPARAM wParam, LPARAM lParam)
{
ZeroPacket* ZP = new ZeroPacket();
ZP->SetData((pcap_pkthdr*)wParam, (u_char*)lParam);
ZP->Serialize(ZData);
Serialize just calls SetData() which is above.