Click here to Skip to main content
15,909,737 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Creating a .docx file programatically? Pin
David Crow30-May-08 7:56
David Crow30-May-08 7:56 
QuestionError with CArray, CMap Pin
Trupti Mehta30-May-08 4:44
Trupti Mehta30-May-08 4:44 
QuestionRe: Error with CArray, CMap Pin
David Crow30-May-08 4:59
David Crow30-May-08 4:59 
AnswerRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 5:52
Jijo.Raj30-May-08 5:52 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta30-May-08 22:41
Trupti Mehta30-May-08 22:41 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj30-May-08 23:16
Jijo.Raj30-May-08 23:16 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta31-May-08 0:38
Trupti Mehta31-May-08 0:38 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj31-May-08 6:28
Jijo.Raj31-May-08 6:28 
Buddy, sorry for the late reply. I went to city with my friend to buy a brand new helmet. Wink | ;) So back to your problem,

Trupti Mehta wrote:
dptMap.GetNextAssoc(pos, key, (DeptDetails& [Wink] dd ); //.GetNextAssoc(pos, key, (DeptDetails*& [Wink] dd);


The reason for your last error is - 3ed parameter of GetNextAssoc() expects CObject*&. Rewrite the code snippet as follows,

DeptDetails* dd;
...
dptMap.GetNextAssoc(pos, key, ((CObject*&)dd);



Trupti Mehta wrote:
How to resolve this error yet? Do i have to write another operator= for DeptDetails*. Can you let me know the code so I don't make mistake again.


I hope everything will be solved by this fix. Smile | :) Yep, I've posted the code snippet!


Trupti Mehta wrote:
One more query I have:
I wanted to store deptNo (int) as key & DeptDetails as value in a Map. I looked at CMap but couldn't find any method to iterate the map contents, hence selected CMapStringToPtr seemed to be best suited to store deptNo in the form of CString. Is this decision correct or should I approach some other class of CMap.



1) You can iterate CMap by using GetStartPosition() and GetNextAssoc().
2) Since your intention is to keep int as key, instead of CMapStringToPtr, CMapWordToPtr will be more suitable, because it have mapkey as word by default and you can avoid that DepartNo to CString conversion.

Feel free to ask more doubts, if you have. Smile | :)

Regards,
Jijo.

_____________________________________________________

http://weseetips.com[^] Visual C++ tips and tricks. Updated daily.

GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 0:05
Trupti Mehta1-Jun-08 0:05 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 1:59
Jijo.Raj1-Jun-08 1:59 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta1-Jun-08 8:57
Trupti Mehta1-Jun-08 8:57 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj1-Jun-08 23:11
Jijo.Raj1-Jun-08 23:11 
GeneralRe: Error with CArray, CMap Pin
Trupti Mehta2-Jun-08 2:09
Trupti Mehta2-Jun-08 2:09 
GeneralRe: Error with CArray, CMap Pin
Jijo.Raj2-Jun-08 4:27
Jijo.Raj2-Jun-08 4:27 
QuestionCannot run the exe of my application Pin
vijay_aroli30-May-08 2:55
vijay_aroli30-May-08 2:55 
QuestionRe: Cannot run the exe of my application Pin
David Crow30-May-08 3:15
David Crow30-May-08 3:15 
AnswerRe: Cannot run the exe of my application Pin
Mike Dimmick30-May-08 7:16
Mike Dimmick30-May-08 7:16 
QuestionHow to remove a folder and all its contents Pin
piul30-May-08 0:25
piul30-May-08 0:25 
QuestionRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:32
mveCPallini30-May-08 0:32 
AnswerRe: How to remove a folder and all its contents Pin
piul30-May-08 0:44
piul30-May-08 0:44 
GeneralRe: How to remove a folder and all its contents Pin
CPallini30-May-08 0:59
mveCPallini30-May-08 0:59 
GeneralRe: How to remove a folder and all its contents Pin
piul30-May-08 1:05
piul30-May-08 1:05 
AnswerRe: How to remove a folder and all its contents Pin
vijay_aroli30-May-08 0:59
vijay_aroli30-May-08 0:59 
AnswerRe: How to remove a folder and all its contents Pin
Michael Schubert30-May-08 1:43
Michael Schubert30-May-08 1:43 
AnswerRe: How to remove a folder and all its contents Pin
David Crow30-May-08 3:17
David Crow30-May-08 3: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.