Accessing a CTypedPtrArray obj. from a child dialog?
-
Hi. Im having a rather stupid problem: I have a Cwnd class that has a CTypedPtrArray variable. On a handler, i want to create a Modal dialog and intialize it with some values from the CTypedPtrArray variable in the parent. After i get a valid address to the parent, i can access any variable. My problem is when i try to access the objects in the CTypedPtrArray. The address from "m_array.GetAt(i)" returns ok but the class public variables have bad pointers. Even during normal dialog execution, i cant access it, although i can access all other parent's variable, including a normal pointer to an object of the same class of the CTypedPtrArray array. Any suggestion? thanks in advance Miguel Lopes
-
Hi. Im having a rather stupid problem: I have a Cwnd class that has a CTypedPtrArray variable. On a handler, i want to create a Modal dialog and intialize it with some values from the CTypedPtrArray variable in the parent. After i get a valid address to the parent, i can access any variable. My problem is when i try to access the objects in the CTypedPtrArray. The address from "m_array.GetAt(i)" returns ok but the class public variables have bad pointers. Even during normal dialog execution, i cant access it, although i can access all other parent's variable, including a normal pointer to an object of the same class of the CTypedPtrArray array. Any suggestion? thanks in advance Miguel Lopes
How exactly are you getting a pointer to the parent? Is there any multithreading involved? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
-
How exactly are you getting a pointer to the parent? Is there any multithreading involved? Joaquín M López Muñoz Telefónica, Investigación y Desarrollo
There is no multithreading, at least for now. Im creating it like this: CMyParent* wnd=(CMyParent *)this->GetParent(); int size=wnd->m_array.GetCount(); //<----this works well CString str=wnd->m_array[i]->m_inner_variable; //<--bad ptr, and its valid outside it! ///////////////////////////////////////////////// ANOTHER EXAMPLE i have an array of CMyObject; i created in the dialog a class member CMyObject* obj; then, when i create in the parent window CMyDialog dlg; dlg.obj=m_array.GetAt(i); then when i access "obj" from the OnInitDialog funtion, it works fine!!! The problem is that by this way, i cant add it dinamically, except if i duplicate the whole array.
-
There is no multithreading, at least for now. Im creating it like this: CMyParent* wnd=(CMyParent *)this->GetParent(); int size=wnd->m_array.GetCount(); //<----this works well CString str=wnd->m_array[i]->m_inner_variable; //<--bad ptr, and its valid outside it! ///////////////////////////////////////////////// ANOTHER EXAMPLE i have an array of CMyObject; i created in the dialog a class member CMyObject* obj; then, when i create in the parent window CMyDialog dlg; dlg.obj=m_array.GetAt(i); then when i access "obj" from the OnInitDialog funtion, it works fine!!! The problem is that by this way, i cant add it dinamically, except if i duplicate the whole array.
Hello? HELP!!! Im getting despered!! X| X| X|