Murray Bilker
April 3rd, 1999, 07:36 PM
I have been trying to add a new string to a combobox control on a parent dialog from one of it's children. I use the following to get a pointer to the parent dialog;
CParent* pParent; // in the header file
pParent = (CParent*) this->GetOwner(); // In the cpp file
I can read the parents variables in the child like this;
int nNumVar = pParent->m_NumVar;
I can only update the parents variables from the child with the following code;
((CParent*)pParent->m_NumVar = nNumVar;
Now I need to add a new string in a combobox from the child. The following two examples seem to be correct but don't work. Intellisense shows everything to me and lets me select the methods and the variables and compiles ok.
pParent->GetDlgItem(IDC_COMBOBOX)->AddString(strSomething);
or
((CParent*)pParent)->GetDlgItem(IDC_COMBOBOX)->AddString(strSomething);
Unfortunetly when I run the program I get an assertion error that says the controls m_pWnd value is NULL.
What can I do. Any help or comments will be greatly appreciated.
Murray Bilker murray@philalock.com
Philadelphia Locking Systems Corp
CParent* pParent; // in the header file
pParent = (CParent*) this->GetOwner(); // In the cpp file
I can read the parents variables in the child like this;
int nNumVar = pParent->m_NumVar;
I can only update the parents variables from the child with the following code;
((CParent*)pParent->m_NumVar = nNumVar;
Now I need to add a new string in a combobox from the child. The following two examples seem to be correct but don't work. Intellisense shows everything to me and lets me select the methods and the variables and compiles ok.
pParent->GetDlgItem(IDC_COMBOBOX)->AddString(strSomething);
or
((CParent*)pParent)->GetDlgItem(IDC_COMBOBOX)->AddString(strSomething);
Unfortunetly when I run the program I get an assertion error that says the controls m_pWnd value is NULL.
What can I do. Any help or comments will be greatly appreciated.
Murray Bilker murray@philalock.com
Philadelphia Locking Systems Corp