Assertion in WinNt 4.0 but not in Win95 (CPropertyPage)

I have developed an application in VC ++ 4.0 in Win 95. My application uses CPropertySheet and CPropertPage to implement a Wizard. When I build the proyect for first time an Assertion rises, but this only occurs the first time and it is not a problem. Up to this point everything is normal.
(It is documented in VC++ that the operative system
handles the assertion and it must be ignored. The assertion cause is that the propertypage resource is read only, and the program is trying to write on it.)

The problem comes when I tried to rebuild and execute the same code  in Win NT 4.0. Then, at the same point arises a Debug Assertion Failed (in dlgdata.cpp Line 575),
but this assertion occurs always and I can not get rid of it.

The assertion fails when I press the next buttom in the first page of the Wizard.
      Could you help me!!! A solution could be to change a read only resource to read and write, but I don't know how. (?????????????)

Thanks !!!!
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Could you point out exactly in what method the assertion occurs!
I have Visual C++ 5.0 and I'm not sure the asserted linenumber are the same in 4.0.
Your problem is with a control inside your property page. You seem to have used classwizard to assign a variable for one of the controls. And for some reason you have deleted the control from the page but forgotten to remove the associated variables. Apparently, DDX_Control() function is throwing a validation assertion for this control.

Please check throughly , which control was removed and also remove the links to that control if you don't want them anymore. If this is not the case, please explain in detail of the symptoms of the problem viz. OLE custom contro usage, some code fragments etc.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
MariaLamelasAuthor Commented:
About syjwg's comment:

Now, I have tried to run the program in VC 5.0 and the assertion
comes, exactly in the same place:

When I press the Next Button of the Wizard first page, the following assertion raises :

void AFXAPI DDX_Control(CDataExchange* pDX, int nIDC, CWnd& rControl)
      if (rControl.m_hWnd == NULL)    // not subclassed yet
--->            ASSERT(!pDX->m_bSaveAndValidate);

            HWND hWndCtrl = pDX->PrepareCtrl(nIDC);

            if (!rControl.SubclassWindow(hWndCtrl))
                  ASSERT(FALSE);      // possibly trying to subclass twice?

where m_bSaveAndValidate=1 and nIDC=1017 which belongs to a list box control located in the second page of the wizard.

Afterwards, it comes a new Assertion in line 43 of file dlgdata.cpp

HWND CDataExchange::PrepareCtrl(int nIDC)
      ASSERT(nIDC != 0);
      ASSERT(nIDC != -1); // not allowed
      HWND hWndCtrl;
      m_pDlgWnd->GetDlgItem(nIDC, &hWndCtrl);
      if (hWndCtrl == NULL)
            TRACE1("Error: no data exchange control with ID 0x%04X.\n", nIDC);
--->            ASSERT(FALSE);
      m_hWndLastControl = hWndCtrl;
      m_bEditLastControl = FALSE; // not an edit item by default
      ASSERT(hWndCtrl != NULL);   // never return NULL handle
      return hWndCtrl;

Finally it appears a report error that says that "a not supported operation was attempted".

After mbhakta's answer:
You are right, the problem comes from a control but I have checked the code to see if thre were fragments from removed controls and I found nothing.

It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
System Programming

From novice to tech pro — start learning today.