Click here to Skip to main content
15,904,024 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: If my main dialog is minimized, how can I flash on taskbar to notify the user that my program wants attention? Pin
Code-o-mat5-Jun-09 5:41
Code-o-mat5-Jun-09 5:41 
GeneralRe: If my main dialog is minimized, how can I flash on taskbar to notify the user that my program wants attention? Pin
sashoalm6-Jun-09 3:39
sashoalm6-Jun-09 3:39 
QuestionBest book for mfc using visual studio 2005? Pin
m_mun5-Jun-09 4:57
m_mun5-Jun-09 4:57 
AnswerRe: Best book for mfc using visual studio 2005? Pin
Rajesh R Subramanian5-Jun-09 8:38
professionalRajesh R Subramanian5-Jun-09 8:38 
QuestionCMFCRibbonComboBox Not Enabled - Pin
dougwilliams5-Jun-09 3:56
dougwilliams5-Jun-09 3:56 
AnswerRe: CMFCRibbonComboBox Not Enabled - Pin
Code-o-mat5-Jun-09 4:26
Code-o-mat5-Jun-09 4:26 
AnswerRe: CMFCRibbonComboBox Not Enabled - Pin
dougwilliams5-Jun-09 4:40
dougwilliams5-Jun-09 4:40 
QuestionMicrosoft compression utility Pin
vikramlinux5-Jun-09 3:14
vikramlinux5-Jun-09 3:14 
AnswerRe: Microsoft compression utility Pin
Stuart Dootson5-Jun-09 3:33
professionalStuart Dootson5-Jun-09 3:33 
GeneralRe: Microsoft compression utility Pin
vikramlinux5-Jun-09 3:37
vikramlinux5-Jun-09 3:37 
GeneralRe: Microsoft compression utility Pin
Stuart Dootson5-Jun-09 3:39
professionalStuart Dootson5-Jun-09 3:39 
QuestionHow Can I build an Array of Arrays? Pin
Software20075-Jun-09 2:51
Software20075-Jun-09 2:51 
QuestionHow Can I build an Array of Arrays? Pin
David Crow5-Jun-09 2:54
David Crow5-Jun-09 2:54 
AnswerRe: How Can I build an Array of Arrays? Pin
Software20075-Jun-09 2:57
Software20075-Jun-09 2:57 
AnswerRe: How Can I build an Array of Arrays? Pin
Code-o-mat5-Jun-09 2:58
Code-o-mat5-Jun-09 2:58 
GeneralRe: How Can I build an Array of Arrays? Pin
Software20075-Jun-09 3:11
Software20075-Jun-09 3:11 
GeneralRe: How Can I build an Array of Arrays? Pin
Code-o-mat5-Jun-09 3:15
Code-o-mat5-Jun-09 3:15 
GeneralRe: How Can I build an Array of Arrays? Pin
Software20075-Jun-09 3:23
Software20075-Jun-09 3:23 
GeneralRe: How Can I build an Array of Arrays? Pin
Code-o-mat5-Jun-09 3:45
Code-o-mat5-Jun-09 3:45 
GeneralRe: How Can I build an Array of Arrays? Pin
Software20075-Jun-09 4:03
Software20075-Jun-09 4:03 
GeneralRe: How Can I build an Array of Arrays? Pin
Software20075-Jun-09 4:37
Software20075-Jun-09 4:37 
GeneralRe: How Can I build an Array of Arrays? Pin
Code-o-mat5-Jun-09 4:58
Code-o-mat5-Jun-09 4:58 
Here:

Software2007 wrote:
if(i==0){
a.Add((CObject*)&as);
array2.Add(&a);
}

you add as to the array a and then add a to array2, right? So the first item of a is as and the first item of array2 is a.
Now here:
Software2007 wrote:
if(i==1){
a.Add((CObject*)&bs);
array2.Add(&a);
}

you add bs to the array a, so the first item of a is as and the seond item of a isbs, then you add a again to array2 so both the first and second item of array2 is a, right?
Here:

Software2007 wrote:
if(i==2){
a.Add((CObject*)&cs);
array2.Add(&a);
}

you add cs to the array a, so the first item of a is as, the second item is bs and the third item is now cs. Then you add a again to array2, so now array2 has 3 items and all 3 items is a, right?
When you do this:
Software2007 wrote:
aRetrieveArray.Copy( *(CObArray*)array2.GetAt(0));
bRetrieveArray.Copy( *(CObArray*)array2.GetAt(1));
cRetrieveArray.Copy( *(CObArray*)array2.GetAt(2));

you actually copying the array a into aRetrieveArray, bRetrieveArray and cRetrieveArray, since all 3 items of array2 is a. Later here:
Software2007 wrote:
CString *astr = (CString *)aRetrieveArray.GetAt(0);
CString *bstr = (CString *)bRetrieveArray.GetAt(0);
CString *cstr = (CString *)cRetrieveArray.GetAt(0);

, since all 3 arrays contain a copy of a you will put the first element of a, which is a pointer to as, into astr, bstr and cstr and then get the string in the message box "as\nas\nas".

Please note that CObjArray contains pointers to objects, not copies of objects, so if you add a pointer to a 3 times to the same array, it will contain 3 pointers to the original a, not 3 copies of a which then live separate lifes.

> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <

GeneralRe: How Can I build an Array of Arrays? Pin
Software20075-Jun-09 5:05
Software20075-Jun-09 5:05 
GeneralRe: How Can I build an Array of Arrays? Pin
Code-o-mat5-Jun-09 5:08
Code-o-mat5-Jun-09 5:08 
GeneralRe: How Can I build an Array of Arrays? [modified] Pin
Software20075-Jun-09 5:17
Software20075-Jun-09 5:17 

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.