Re: Debug Assertion Failed!!
You shouldn't need the Invalidate() call. The OS will detect which areas of the screen need repainted when your dialog gets destroyed. Your call is marking the dialog needing repainted, then your destroy it, so when Windows tries to post you WM_PAINT I bet that's the ASSERT (hWnd not valid or some such thing?).
MJA
Re: Debug Assertion Failed!!
Hi
Debug assertion failed because you are calling Invalidate method for C++ object wich does not contain REAL Windows object (they are not same) inside. For CDialog derived objects you must call DoModal() or Create() methods to create REAL Dialog.Only after then you can call Invalidate() method . But...
As I understand you alraedy have REAL CAdminDlg object (your main window). And you'd like to call Invalidate() method for this existing object. Then you must do
1. add a member variable to CScsetting class
CAdminDlg * m_admindlg; // pointer to CAdminDlg
2 . CScsetting class constructor
CScsetting:: CScsetting (CWnd *parent)
{
m_admindlg=parent;
.........
.........
}
3. Pass to CScsetting class constructor adress of existing CAdminDlg object. If you are creating CScsetting object in CAdminDlg member function then
CScsetting dlg(this);
dlg.DoModal ;
4. In CScsetting::OnOK() remove line
CAdminDlg m_admindlg; // ERROR !!!!!!!!!!!
and call
m_admindlg->Invalidate(); // instead of m_admindlg.Invalidate();
It will work
Regards
Zorik Galstyan