How can I test an Object to see if it already exists?
REF : Visual C++ 6
Hello
I have created a dialog and it's class;
I created a member variable of the created dialog class in the main dialog;
CGraphDlg m_dlgGraph;
Later in the Main dialog code I create the second dialog and show it.
void CSmithGraphDlg::OnBopenGraph()
{
// TODO: Add your control notification handler code here
m_dlgGraph.Create(IDD_SGRAPH, this);
m_dlgGraph.ShowWindow(SW_SHOW);
}
Is there a way to test 'm_dlgGraph' variable, before I try and create the dialog object to see if is already attached to an existing dialog object?
if there is a method for this, will it work with other objects ?
thanks
Re: How can I test an Object to see if it already exists?
Quote:
Originally posted by hickock6
Is there a way to test 'm_dlgGraph' variable, before I try and create the dialog object to see if is already attached to an existing dialog object?
Code:
if(!m_dlgGraph.GetSafeHwnd())
m_dlgGraph.Create(IDD_SGRAPH, this);
m_dlgGraph.ShowWindow(SW_SHOW);
Quote:
Originally posted by hickock6
if there is a method for this, will it work with other objects ?
It will work with all 'CWnd' derived ones... :cool: