Click here to Skip to main content
15,888,521 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: PreTranslate Message problem Pin
santhoshv848-Oct-07 17:15
santhoshv848-Oct-07 17:15 
GeneralRe: PreTranslate Message problem Pin
chandu0048-Oct-07 22:04
chandu0048-Oct-07 22:04 
Questionradio button Pin
viliam8-Oct-07 6:35
viliam8-Oct-07 6:35 
AnswerRe: radio button Pin
Mark Salsbery8-Oct-07 7:05
Mark Salsbery8-Oct-07 7:05 
GeneralRe: radio button Pin
viliam8-Oct-07 7:51
viliam8-Oct-07 7:51 
GeneralRe: radio button Pin
Mark Salsbery8-Oct-07 8:05
Mark Salsbery8-Oct-07 8:05 
GeneralRe: radio button Pin
viliam8-Oct-07 8:36
viliam8-Oct-07 8:36 
QuestionAdvanced Pointers and References [modified] Pin
aquawicket8-Oct-07 5:05
aquawicket8-Oct-07 5:05 
I have multiple levels of functions that I would like to have pointing to the same data. I have things set up like so. I have an issue that when I get into func2.. str1[0].myStr does not have data; I'm screwing this up somewhere.

<br />
struct myStruct{<br />
    int myInt;<br />
    CString myStr;<br />
};<br />
<br />
void main()<br />
{<br />
    myStruct *st1 = new myStruct[10];<br />
    st1[0].myStr = "test1";  <br />
    Class1 *cls1 = new Class1(st1[0]);<br />
}<br />
<br />
///////  CLASS 1<br />
class Class1<br />
{<br />
    myStruct *m_pSt1;<br />
}<br />
<br />
void Class1:Class1(myStruct &st2)<br />
{<br />
    m_pSt1 = &st2;<br />
    Class2 *cls2 = new Class2(m_pSt1->myStr);<br />
}<br />
<br />
void Class1::OnFileSave()<br />
{<br />
    //get value of str<br />
    MessageBox(m_pSt1->myStr);   //this has no data!! but is fine if Class2::OnEventFunc2() gets processed or is omitted<br />
}<br />
<br />
<br />
<br />
///////  CLASS 2<br />
class Class2<br />
{<br />
    CString *pMyStr;<br />
};<br />
<br />
void Class2::Class2(CString &myStr2)<br />
{<br />
   m_pMyStr = &myStr2<br />
}<br />
<br />
void Class2::OnEventFunc2()<br />
{<br />
    *m_pMyStr = "test3";  //when this is omitted everything works ok<br />
    //if it is there, str1[0].myStr does not have data, even if this<br />
    //function is never called.<br />
}<br />


Thanks in advance for any help on this Smile | :)






-- modified at 11:33 Monday 8th October, 2007
AnswerRe: Advanced Pointers and References Pin
toxcct8-Oct-07 5:11
toxcct8-Oct-07 5:11 
GeneralRe: Advanced Pointers and References Pin
aquawicket8-Oct-07 5:15
aquawicket8-Oct-07 5:15 
GeneralRe: Advanced Pointers and References Pin
toxcct8-Oct-07 5:21
toxcct8-Oct-07 5:21 
GeneralRe: Advanced Pointers and References Pin
aquawicket8-Oct-07 5:29
aquawicket8-Oct-07 5:29 
GeneralRe: Advanced Pointers and References Pin
toxcct8-Oct-07 5:38
toxcct8-Oct-07 5:38 
GeneralRe: Advanced Pointers and References Pin
aquawicket8-Oct-07 5:42
aquawicket8-Oct-07 5:42 
GeneralRe: Advanced Pointers and References Pin
aquawicket8-Oct-07 6:31
aquawicket8-Oct-07 6:31 
Questionerror no such interface supported Pin
jomons8-Oct-07 4:28
jomons8-Oct-07 4:28 
AnswerRe: error no such interface supported Pin
Iain Clarke, Warrior Programmer8-Oct-07 6:31
Iain Clarke, Warrior Programmer8-Oct-07 6:31 
QuestionHorizontal scroll bar for CListCtrl(report view) Pin
shir_k8-Oct-07 4:05
shir_k8-Oct-07 4:05 
QuestionGenerate class diagrams - VS2005 MFC C++ Pin
Andy H8-Oct-07 3:43
Andy H8-Oct-07 3:43 
AnswerRe: Generate class diagrams - VS2005 MFC C++ Pin
Maxwell Chen8-Oct-07 21:45
Maxwell Chen8-Oct-07 21:45 
QuestionCan Some one please help me out very urgent ? Pin
oronnorh8-Oct-07 3:23
oronnorh8-Oct-07 3:23 
QuestionRe: Can Some one please help me out very urgent ? Pin
David Crow8-Oct-07 3:30
David Crow8-Oct-07 3:30 
AnswerRe: Can Some one please help me out very urgent ? Pin
oronnorh8-Oct-07 3:36
oronnorh8-Oct-07 3:36 
GeneralRe: Can Some one please help me out very urgent ? Pin
toxcct8-Oct-07 3:39
toxcct8-Oct-07 3:39 
GeneralRe: Can Some one please help me out very urgent ? Pin
oronnorh8-Oct-07 4:38
oronnorh8-Oct-07 4:38 

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.