We help IT Professionals succeed at work.

Assertion in WinNt 4.0 but not in Win95 (CPropertyPage)

MariaLamelas
MariaLamelas asked
on
302 Views
Last Modified: 2013-11-20
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 !!!!
Comment
Watch Question

Commented:
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.
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION

Author

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?
                  AfxThrowNotSupportedException();
            }

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);
            AfxThrowNotSupportedException();
      }
      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.

Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.