Click here to Skip to main content
15,927,593 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Has anybody programmed SNMP? Pin
Masaaki Onishi5-Oct-01 15:21
Masaaki Onishi5-Oct-01 15:21 
QuestionHow can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
youssef5-Oct-01 10:23
youssef5-Oct-01 10:23 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Christian Graus5-Oct-01 10:59
protectorChristian Graus5-Oct-01 10:59 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Paolo Messina5-Oct-01 11:01
professionalPaolo Messina5-Oct-01 11:01 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Leo Smith5-Oct-01 11:05
Leo Smith5-Oct-01 11:05 
AnswerRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Fazlul Kabir5-Oct-01 11:27
Fazlul Kabir5-Oct-01 11:27 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Christian Graus5-Oct-01 16:53
protectorChristian Graus5-Oct-01 16:53 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Fazlul Kabir6-Oct-01 11:28
Fazlul Kabir6-Oct-01 11:28 
Actually, you don't need to typecast when you call CPtrArray::Add() method. However, you're right, you need to do that when you get the struct back using GetAt() method.


If typecasting bothers you too much, you can instead use MFC's template class CTypedPtrArray (declared in afxtempl.h). In this case, you don't need to typecast while calling GetAt() method. Here is how this works:


CTypedPtrArray < CPtrArray, MyStruct* > m_Array; 

m_Array.Add(&struct1);
m_Array.Add(&struct2);

// And to get the structs back later:

MyStruct* pStruct1 = m_Array.GetAt(0);
MyStruct* pStruct2 = m_Array.GetAt(1);



// Fazlul



Get RadVC today! Play RAD in VC++
http://www.capitolsoft.com

GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Christian Graus6-Oct-01 11:51
protectorChristian Graus6-Oct-01 11:51 
GeneralRe: How can I do a Dynamic Array like CByteArray for a STRUCT array ? Pin
Fazlul Kabir6-Oct-01 18:06
Fazlul Kabir6-Oct-01 18:06 
GeneralCListView with a Timer Pin
daniel995-Oct-01 10:14
daniel995-Oct-01 10:14 
GeneralRe: CListView with a Timer Pin
Andres Manggini5-Oct-01 10:43
Andres Manggini5-Oct-01 10:43 
QuestionHow do I use CButton::Create() to make a push button check box? Pin
Bart-Man5-Oct-01 10:12
Bart-Man5-Oct-01 10:12 
AnswerRe: How do I use CButton::Create() to make a push button check box? Pin
Fazlul Kabir5-Oct-01 10:17
Fazlul Kabir5-Oct-01 10:17 
GeneralRe: How do I use CButton::Create() to make a push button check box? Pin
Bart-Man5-Oct-01 10:22
Bart-Man5-Oct-01 10:22 
AnswerFinal Solution Pin
Bart-Man5-Oct-01 10:55
Bart-Man5-Oct-01 10:55 
GeneralConnect() timeout Pin
Alex Griffing5-Oct-01 9:27
Alex Griffing5-Oct-01 9:27 
GeneralOverriding CWndClassInfo in ATL Pin
5-Oct-01 8:05
suss5-Oct-01 8:05 
GeneralDisplay attributes Pin
john john mackey5-Oct-01 7:32
john john mackey5-Oct-01 7:32 
GeneralRe: Display attributes Pin
5-Oct-01 7:36
suss5-Oct-01 7:36 
GeneralDisabling item in CListCtrl Pin
5-Oct-01 7:02
suss5-Oct-01 7:02 
GeneralRe: Disabling item in CListCtrl Pin
Masaaki Onishi5-Oct-01 9:59
Masaaki Onishi5-Oct-01 9:59 
GeneralCreating window like Taskbar Pin
5-Oct-01 6:57
suss5-Oct-01 6:57 
GeneralRe: Creating window like Taskbar Pin
Michael Dunn5-Oct-01 8:27
sitebuilderMichael Dunn5-Oct-01 8:27 
GeneralRe: Creating window like Taskbar Pin
Ravi Bhavnani6-Oct-01 8:02
professionalRavi Bhavnani6-Oct-01 8:02 

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.