Hello,

I have a SDI with a form. The form has a button on it which creates a modeless dialog when it is clicked.
After the user click on it I disabled the button. I would like to enable it when the user closes the dialog, but I can't make it work. My code is as follows:

I created a friend function of CView called EnableButtons and a CButton variable called mybutton. Then I am calling the function from the dialog. Until then everything works.
The code inside EnableButtons is:

CTestView* pButton;
pButton = new CTestView();
pButton->mybutton.EnableWindow(TRUE);

Then it compiles perfectly but when I click on the dialog button I get an error:

Debug Assertion Failed!

Could anybody please help me? Thanks,

Marcelo